DoCMD to open a form

beckie1234

Struggling Student
Local time
Yesterday, 22:16
Joined
Mar 10, 2007
Messages
94
I am using a
DoCmd.RunCommand acCmdRecordsGoToNew
to open a form starting at the point where a user can enter new data, but when I put it on a switchboard it will only start on a new entry and won't let the user see any previous entries. How do I make it open for data entry but still be able to see any previous records?
 
You could put a number of different buttons on the switchboard, and then use OpenArgs to specify how the form opens depending on the button that has been clicked.
 
I not sure what you mean. One area was for opening form for entering data into tables. The second button would open up a form that stores data for downtime, The third button would open a form that when you click on a certain button a particular report will open. The DoCMD sits in the ON OPEN code. How would I use OpenArgs in their place??
 
You might try setting the data entry property of the form to No.


Hth
 
OpenArgs is the last element of the DoCmd you could put "New" as your OpenArgs on the button that allows the form to be opened at the new record.

You then need to have a logical check of the OpenArg in the on load event of your form, then depending on the OpenArg you can control how/where the form opens.
 
As Rak said, put NO in Data Entry property.
 
Data Entry does say NO and put the code in the onload event
DoCmd.RunCommand acCmdRecordsGoToNew and when I open the form to update the table it shows 1 and allows me to enter new data to the table, but still doesn't show any previous data. Any suggestions
 
Check do you have any data in table.
 
Hi, this works for me, you could adapt it to fit to your form name

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Table2"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acNewRec

It opens at new record but lets you scroll to previous records.
 
The table has data in it. I put the code
DoCmd.RunCommand acCmdRecordsGoToNew in the onload event.

When I created the Switchboard button to access the form for data entry I said to open the form in edit mode and not add mode and now it seems to work. So far.
 
The table has data in it. I put the code
DoCmd.RunCommand acCmdRecordsGoToNew in the onload event.

When I created the Switchboard button to access the form for data entry I said to open the form in edit mode and not add mode and now it seems to work. So far.

As you've discovered, opening in Add mode IS the same as setting the form's data entry property to YES.
 
the way I would do it is have a form with a combo box for finding a record aka the Combo box wizard.
then open the form for data entry

DoCmd.OpenForm stDocName, , , acFormAdd, acDialog

when the form is open you can still use the combo box to search for all the records in the underlying recordset.

or you can have another button to open the form in nornal mode

DoCmd.OpenForm stDocName, , , , acDialog
 
The table has data in it. I put the code
DoCmd.RunCommand acCmdRecordsGoToNew in the onload event.

When I created the Switchboard button to access the form for data entry I said to open the form in edit mode and not add mode and now it seems to work. So far.

You might try this :
- Set the data entry property of the form1 to No
- Remove the code on the onload event in form1
- Ensure that the button on your switchboard opens the form1

Hth
 

Users who are viewing this thread

Back
Top Bottom