DoMenuItem To RunCommand Method

Aug 2, 2006

To save records in a form, close the form and open a switchboard, I have the following Event code on clicking a command button on the form:

'Command on last page to save records and go to Switchboard
Private Sub OpenSwitchboard_Click()
On Error GoTo Err_OpenSwitchboard_Click

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.Close acForm, "CaseNotes", acSaveYes
DoCmd.OpenForm "frmSwitchboard"

Exit_OpenSwitchboard_Click:
Exit Sub

Err_OpenSwitchboard_Click:
MsgBox Err.Description
Resume Exit_OpenSwitchboard_Click

End Sub

This seems to work okay in Access 2000, but I understand the DoMenuItem method is obsolete, and that I should replace "DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70" to a RunCommand method, but I am not sure about this.
I would be grateful for any help in replacing this piece of DoMethod code with RunCommand code! mcchu

View Replies


ADVERTISEMENT

Hiding Access Window With DoCmd.runCommand AcCmdAppMinimize

Mar 28, 2007

Ok, I finally have it working the way I like. It's really slick - the main form (set to "PopUP" and with docmd.runcommand accmdappminimize line in the On_Open event) opens with customized icon (in titlebar and in windows taskbar) and behaves like a standalone program (you only see Access the first few seconds during opening before it's minimized).

The form can be minimized to windows taskbar and clicked to restore it (form's maximize button is disabled, for appearance sake). it can also be accessed via the alt-tab windows menu, where it also appears with a custom icon. so it's really slick, it behaves just like a standalone app. read on for the ", but..."

I also wrote 2 functions to handle reports.

1st (fnOpen, I also use it for forms, etc. via arguments, but only the reports have the following logic). This one closes my main form, maximizes Access (which has all menus/toolbars disabled, so it doesn't really look like Access, looks like a report viewer). This function is placed into all report buttons' On_Click event with report name as argument and object type (3 for report, because 0=table, 1=query, 2=form, 3=report in my fnOpen).

2nd. (fnCloseReport) is placed into all reports' On_Close event. This function opens my main form again on the tab from which report was called. It works, but herein lies the problem: after the form reopens, it no longer has the whole application's custom icon, but the Access "form" icon. And after this, if minimized to windows taskbar it actually minimizes as resized mini-window above the Start button (as has been described by others, just as it would within Access it it were visible) and Access appears minimized in the windows taskbar, so somehow the whole cool "standaloneness" is turned off.

I wonder if anyone has some suggestions for this. I spent some time researching and testing this and really like the functionality. When the form is displayed without Access, it cannot be right-clicked (at all), which is very useful (although I know there are other ways of protection).

BTW, all my other windows (all popup/modal) appear on top of the main form with no problems. I have "File Open" and "Save As" windows common dialogs that my app calls (via API) and I also have a custom form acting as dialog box (I use the acDialog intrinsic constant when I open it from code). so mutliple windows are not an issue as some have suggested.

Thanks in advance!

View 3 Replies View Related

Trapping "The DoMenuItem Action Was Cancelled" On No To Delete Record

Jun 7, 2006

:confused: Anyone know how to trap/prevent the msg "The DoMenuItem action was cancelled" after answering no to deleting a record? I followed the instructions at the following thread but no luck:

http://www.access-programmers.co.uk/forums/showthread.php?t=53206&highlight=DoMenuItem+action+cancelled

Here's the code:

----------------------------------
Private Sub Delete_Click()
On Error GoTo Err_Delete_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_Delete_Click:
Exit Sub
Err_Delete_Click:
MsgBox Err.Description
Resume Exit_Delete_Click
End Sub

-----------------------------------
Private Sub Form_Delete(Cancel As Integer)
DoCmd.SetWarnings False
If MsgBox("Are you sure you want to delete this record?", vbYesNo) = vbNo Then
Cancel = True
Else
MsgBox "Record deleted!"
End If
End Sub
-------------------------------------

Thanks in advance.

View 2 Replies View Related

Is This The Best Method?

Jan 8, 2008

Hi,

I have a form which has a subform. For each record, I have to assign a user, which comes from a user table. Due to the large number of users I have created a user selection form, which is designed as a popup. This form has an option group to select department, which then filters a combo box for selection of a user. On clicking a user, the window closes and that username is inserted into the form.

Since this particular user form will be used in multiple locations, I was thinking of having a global variable, which is set when a field is clicked. i.e. a variable called nameSelect. When a user is being assigned in form A, the user field is clicked, nameSelect = 3.

I was then thinking of having within the user selection form coding a Select Case function which depending on the value of nameSelect assigned the selected user to the correct location.

Is this the best method to tackle this?

View 2 Replies View Related

Using The FindFirst Method With DAO

Aug 1, 2005

I am writing an event procedure to check to see if a particular Project number exist in a recordset. I am trying to use the findfirst method and are having some problems. Here is my code.

Private Sub Command3_Click()

Dim db As DAO.Database
Dim rs As DAO.Recordset, ProjectNo As String, SqlStr As String, StrProjectNo As String


Set db = CurrentDb()
Set rs = db.OpenRecordset("tblTrackingSheetFrm", dbOpenTable)
StrProjectNo = Me![ProjectNumber]
rs.FindFirst StrProjectNo

If rs.NoMatch Then
Forms![frmProjectCriteria].Visible = False
DoCmd.SetWarnings WarningsOff
DoCmd.OpenQuery "(1)qryDeletetblTrackingSheetFrm"
DoCmd.OpenQuery "(1A)qryDeletetblTrackingSheetTMP"
DoCmd.OpenQuery "(2)qryAppendProjectTasks"
DoCmd.OpenQuery "(3)qryMaketblLaborActuals"
DoCmd.OpenQuery "(3A)qryUpdatetblTrackingSheetTMP"
DoCmd.OpenQuery "(4)qryDeletetblMaterialActualsTMP"
DoCmd.OpenQuery "(5)qryAppendEquipment"
DoCmd.OpenQuery "(6)qryAppendInventory"
DoCmd.OpenQuery "(7)qryAppendPayables"
DoCmd.OpenQuery "(8)qryAppendPurchaseOrder"
DoCmd.OpenQuery "(9)qryUpdateMaterialActuals"
DoCmd.OpenQuery "(A)qryAppendtblTrackingSheetFrm"

DoCmd.SetWarnings WarningsOn
DoCmd.OpenForm "frmTrackingSheet", acNormal

Else

MsgBox " Project worksheet already opened by another user."

rs.Close
End If
End Sub

What this does is check to see if another user has a project open and if so doesnt allow that user to access that project. I am getting the following error when I execute the procedure on the findfirst Code line.

Runtime error 3251 Operation is not supported by this object type.
Can someone take a look and see what I am doing wrong.
Any help is greatly appreciated.

View 2 Replies View Related

Best Deliverable Method

Jan 3, 2006

Hi

I just want to ask what is the best method to deliver an application to the user. The reason of asking is that it needs user to have access software installed which is not cheap Any other method that can help, some sort of exe file that can run without access software or atleast something free...

R

View 1 Replies View Related

FindRecord Method

Apr 24, 2007

When trying to use FindRecord I get a "Runtime error 2406 - the command or action 'FindRecord" isn't available now". The script up to that point is as follows:

Sub Test()

Dim Connection As New ADODB.Connection
Dim Catalog As New ADOX.Catalog
Dim rstRain As New ADODB.Recordset
Dim ppn_0900 As Field

Set Connection = CurrentProject.Connection
Call rstRain.Open("0800Rain", Connection, adOpenForwardOnly)

DoCmd.FindRecord "10", , False, acDown, , acAll


Can anyone point me in the right direction?

View 2 Replies View Related

Best Method Of Storing This Data?

Jun 7, 2005

Hi everyone,

I've recently begun building a database to keep track of stock at work. Nothing particularly special or difficult. I have a little bit of prior experience with Access and VB, but not heaps.

Basically, I've created a tables for parts, companies etc, and am relating all the data together.

At the moment I've made a form that allows you to enter a new part, with Part Number, Description, Category, Supplier, etc.

The complication comes when I want to create an ASSEMBLY of parts. I'd like to create an assembly (which has a lot of similarities to a part, in that it has a part number, description etc), and that assembly needs to store a list of parts that it includes. A simple assembly might include a few items, ie, a bowl of meatballs includes the bowl, a fork, the spaghetti, and 5 meatballs. A more complex assembly (a complete dinner for 5) might include 5 bowls of meatballs (a sub assembly), pepper and salt, 5 glasses and two bottles of coke.

I'm not sure how to best store this assembly data...

I can't really have a table with a finite number of "part" spots because the assemblies get quite large. I'd rather not use an ugly VB macro that stores the PartID's with quantities either, as that could get thoroughly out of hand pretty quickly.

I'm sure there must be a simple method for doing this, but without having a clue as to what it might be called I can't really look for it in help!

Any clues you guys could give me would be great.

Thanks

Col.

View 1 Replies View Related

ComboBox Dropdown Method

Jun 30, 2006

i have set the dropdown method of a combobox in the onfocus event
if then on the click event or exit event for the combobox i validate the entry and find error and move the focus back to the combobox the dropdown method does not appear to work.The focus has clearly been moved away from the combobox but when it returns the dropdown list does not appear
yet it always works the first time you enter the combobox within a form

has anybody else come across this problem!
any solutions

View 1 Replies View Related

Data Entry Method

Aug 3, 2006

I want to have my records in my form show the latest entry, not a completely new form. The user will click on the new record button to create a new record but I want the user to be able to see the last record. Anybody know how to do this?

View 14 Replies View Related

Best Method To Display Data.

Jan 28, 2007

Hello. I am quite new to Access and even newer to this forum. So please be gentle...

My question is quite simple i think. I want to display one particular record.

I have a keyboard wedge barcode scanner.. so basically a quicker and easier way to input digits or letters into a field. I also have lots and lots of CD's DVD's which i want to track and list the contents of, by simply entering the cd/dvd's barcode number istead of having to insert into my pc and browse manually.. if possible searching within results would be good too.~
think of it as a supermarket style.. input number - output entire contents... there could be hundreds or even thousands of programs or music titles,images, videos or documents.. along with any associated data, (where it is stored, who borrowed it last etc)

Can anbody outline the basics for me to implement this? remember i am quite new to Access and databases in general.

Thanks in advance, and keep up the good work on/in this forum. :)

Rob

View 2 Replies View Related

What's The Best Method Of Duplicating A Record?

Feb 22, 2005

Hi,

I want to be able to make an exact copy of an existing record in a table and then change the value of a couple of the fields before writing it to the table as a new record.

What is the best way to go about this? I guess it is possible with select, update and append queries but I'd rather do it in code.

It sounds like it should be a simple and commonly performed exercise but I can't find anything on it.

Thanks in advance!

John

View 4 Replies View Related

TransferSpreadsheet Method Overwriter ?

Apr 17, 2008

quickie -- i am away from my project at the moment - but does the TransferSpreadsheet overwrite existing data ??


i have the transfer set up in to a xls ( this works) but if i change the source will it over write the transfered data (I want it to do this )??

regards

View 2 Replies View Related

Troubleshooting FindRecord Method

Jun 20, 2005

Hello,
I would like to use the FindRecord Method, but something does not work. I would like to find a record which contains the data I entered in an unbound textbox in the form. The action should be started by a command button. As 'Find what'-object I used '=[text61].[text].
Thanks for your help.

View 2 Replies View Related

Use Of OutputTo Method In Macros

Apr 7, 2005

Hi guys,

I’m working on a report that I want to show on the web as a Snapshot file. I created a Macro using OutputTo method to export the report. If I type the file name and location on the Output File it works perfectly, but the problem is that I want Macros to read the file name from a combo box since the file name will change every day. Here is the code I got so far.



C:Test””&FORMS!frm_FORM2!cbo_Name&”.snp”



Every time I run this Macro I got the following message:



“The report snapshot was not created because you don’t have enough free disk space for temporary work files.”

Now!, when I type the file name to that specific location Macro does the job perfectly.



Is there any way I can get the File name from a combo box located in FORM2.



Thank you so very much in advanced. Your help is always a blessing.




Mosquetero

View 2 Replies View Related

Open Method Failed

Sep 27, 2005

Getting an error on the rst.Open statement of
"Method 'Open' of object '_Recordset' failed"

I am using the same code that I have used before, just tweaked some. Earlier I had an error because the ActiveX control was not checked off for the ADODB connection.

Below is the code...any ideas? THANKS!


Dim Conn As ADODB.Connection
Dim rst As New ADODB.Recordset
Dim lg As String
Dim frmOffset As String
Dim tagnm As String
Dim sql1 As String
Set Conn = CurrentProject.Connection

frmOffset = "3. Offset Printing"
lg = "PT"
tagnm = "Label22"
sql1 = "select translation from translation where lang=" & "'" & lg & "'" & "and formname=" & "'" & frmOffset & "'" & " and tagname=" & "'" & tagnm & "'"

rst.Open sql1, Conn, adOpenKeyset, adLockOptimistic
Me.Label22.Caption = rst!translation

View 6 Replies View Related

Combo Populate Method

Jun 7, 2006

Hi, I want that when a value from combo box is selected, based on it the values in the text box should appear. These are all bound columns.

I have written the following code and getting as error "Run time Error 3075" syntax error "missing operator" in query operation at line - >Set rs = db.OpenRecordset(strSQL) in the following code appears. Please help.


Private Sub Assigned_To_LostFocus()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String

Assigned_To.SetFocus
If Assigned_To.Value > 0 Then
strSQL = "SELECT * FROM Department WHERE Assigned To = " & Assigned_To.Value

Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)

If Not rs.BOF Then
Me.Text65 = rs.Fields(1) / Me.Text65 = rs("code")
Me.Department = rs.Fields(2) / Me.Department = rs("Department")
End If
rs.Close
Set rs = Nothing
db.Close
Set db = Nothing
End If
End Sub

View 2 Replies View Related

Queries :: Show DOB That Are At A Certain Age By NOW Method

Jun 18, 2014

Is there a way of finding out who is turning18 years old in the next 6 months on a set day.

Specifically, I want to minus a date of birth from todays date (DateDiff?) and then for it to show those people who will be turning 18 in the next 6 months.

I've tried a range of Datediffs but I can't seem to get what I need.

View 11 Replies View Related

Can Someone Tell Me What This Command/method Prefix Means??

Apr 6, 2006

Hi

I am new to VB.

Can anyone tell me what the 'ac' part of a method, such as 'acReport', actually means. I am guseeing it may be something like Active Command or similar.

There is no other reason that curiosity for me wanting to know this...or is there??

Thanks in advance

View 1 Replies View Related

Object Does Not Support This Property Or Method.

Apr 13, 2007

Hi,

I want to disable a button right after click it. Because I could not disable a control that has got the focus, i tried to shift the focus to another control; however, all controls that I tried to shift the focus to don't support the method (SetFocus = true).

I want to do this on a subform's control, but I keep getting this error:
Object does not support this property or method.

Any susggestions will be very much appreciated.

B:)

View 3 Replies View Related

Best Method Handling Billto ID And Shipto ID

Mar 25, 2007

I would like to see if I am doing this okay. I want to confirm the best manner of storing a BilltoID and a ShiptoId address.

I presently store 1,000 BilltoID's with 1 address each record in table1. Then I have 1,500 ShiptoID's with 1 address each record in table2.

I figure that i would make a main form with a pulldown combo box on the left for soldtoID and have an address travel in from table1. and then a different set to the right with another pulldown combo box for the shipto address pouring in from table 2.

I have looked at some models. they seem to have the BilltoID address is linked to a table1 like mine with one address in a combo box. However the Shipto address section in their samples is a Manual input section and not a table.

So is my method better? That is, using 2 tables and 2 combo boxes on the form.

Unrelated to my Order form, i want to mention that I also have a Contact table with many people who could get letters from us. so i have more address over in that table using 2 fields in this contact table (billtoID and shiptoID). therefore, this Contact table can be used for a subform and connect to a main form using those 2 fields as parent child thing.

thanks you for reading this and giving suggestions before i proceed.

View 1 Replies View Related

Fastest Method For Append Query

Jan 12, 2007

Hi

I would just like to know what the fastest method is for appending data to my table using Visual Basic.

What I'm trying to do is to import a few thousand log-files into an Access DB Table using VB to "decode" the log data and to then generate the Access queries...

Here's what I've tried sofar - both code sections gave me the same results for the 600k records that I imported:
Dim cs As Recordset
Set cs = CurrentDb.OpenRecordset(TBL_CLICKSTREAM)

cs.AddNew
With entry
cs(FLD_COURSE).Value = .course_code
cs(FLD_STUDNUM).Value = .student_number
cs(FLD_PAGE_TYPE).Value = .page_type
cs(FLD_PAGE_DESC).Value = .page_description
cs(FLD_TIME).Value = .timestamp
cs(FLD_PAGE_TITLE).Value = .page_title
End With
cs.Update
AND
Dim db As Database
Dim sql As String

Set db = CurrentDb
With entry
sql = "INSERT INTO " & TBL_CLICKSTREAM & " ([" & FLD_COURSE & "], [" & FLD_STUDNUM & "], [" & FLD_PAGE_TYPE & "], [" & FLD_PAGE_DESC & "], [" & FLD_TIME & "], [" & FLD_PAGE_TITLE & "]) " & _
"VALUES (""" & .course_code & """, " & .student_number & ", """ & .page_type & """, """ & .page_description & """, " & .timestamp & ", """ & .page_title & """)"
End With

db.Execute sql

Is there a faster way of adding these data to the tables?

Thank you in advance

View 2 Replies View Related

Passing Variables In An OpenForm Method

Dec 8, 2005

I can't seem to get the following code to work.
Any help would be appreciated:

Public Function NonConform(strProduct, strBatch As String)

On Error GoTo HandleErr
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmProductNonConforming"
stLinkCriteria = "[ProductName]=" & "'" & strProduct & "'"
stLinkCriteria = stLinkCriteria & "AND [BatchNum]=" & "'" & strBatch & "'"
DoCmd.OpenForm stDocName, , , (stLinkCriteria)
HandleErr:
MsgBox "Error in NonConform Function : " & Err.Description
Resume Next
End Function

View 1 Replies View Related

Module/Method/Fuction Currently Running

Sep 14, 2005

Any idea how to retrieve the name of the Module and the name of the Sub/Function that currently executing?

Show me the door... :-)

View 2 Replies View Related

Criteria For Report Using The SendObject Method

Sep 5, 2007

I am using a macro and the SendObject method to email a snapshot of a report to 29 different program coodinators(which is working fine). Using the macro i have 29 exact reprorts except for the different criteria in the ProgramID field for each program. I would like to get away from the macro and code the SendObject method and specify the criteria for the ProgramID field for a single report. I will most likely use a SelectCase statement for the 29 different programs. Can anyone tell me how to set the varible criteria on a single report using the SendObject method.

View 1 Replies View Related

Modules & VBA :: Run Python Method With Arguments?

Aug 18, 2014

I have a python script "runAll" that takes two arguments: processID (the primary key of one table as a string) and a filename (a full file name path as a string).

Is it possible to run a python method with arguments from inside a VBA script (activated by a button press)?

My python script is called XMLGenerator.py, and the method I want to run is called runAll(processID,filename).

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved