Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form/Record Mode Check 2

Status
Not open for further replies.

OrWolf

MIS
Mar 19, 2001
291
Hi All,
I have a form that I open from a main menu either by selecting an existin record or select to Add. When selecting Add the following code is run:

DoCmd.OpenForm stDocName, acNormal
DoCmd.GoToRecord , , acNewRec

My problem is that in the Open of the form I want to have code modify functionality based on whether the form is in add mode or not, but in the Open and Load the form still sees the first record in the table rather than a new record. How can I check for this? Just set and check a global variable?

Thanks!
 
Have you tried this ?
DoCmd.OpenForm stDocName, acNormal, , , acFormAdd

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Then you can use Me.DataEntry to check and see if your form is in add mode.
 
That worked for the adds, but now when I edit a record the me.DataEntry still shows as true. To edit the record I'm using the following code to open the form:

stLinkCriteria = "[RecordID]=" & "'" & Me![MyListBox] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Perhaps I'm doing this part incorrectly?
 
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
All of the suggestions helped and worked. Thanks a bunch.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top