G
Guest
Hello,
I am trying to use a single form for both viewing old records and adding new
ones. I have one command button on the main form that opens my form and goes
to a new record using:
DoCmd.OpenForm stDocName
DoCmd.GoToRecord acDataForm, stDocName, acNewRec
and another button on the main form that opens the form and goes to a
specific record using:
DoCmd.OpenForm stDocName
and then in the OnLoad area of the form it finds a specific record using:
Set rs = Me.Recordset.Clone
rs.FindFirst stlinkcriteria
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
My problem is that I only want this code in the OnLoad area (along with some
other coding) to run if I click the second button. I don't want to run the
code if it is simply going to a new record. Is there some way to check if the
DoCmd.OpenForm command that is run used the acNewRec option or not? Or
perhaps I am going about this in the wrong way. I checked the
me.form.newrecord, but either way it came back with a 0. Any help would be
greatly appreciated...
I am trying to use a single form for both viewing old records and adding new
ones. I have one command button on the main form that opens my form and goes
to a new record using:
DoCmd.OpenForm stDocName
DoCmd.GoToRecord acDataForm, stDocName, acNewRec
and another button on the main form that opens the form and goes to a
specific record using:
DoCmd.OpenForm stDocName
and then in the OnLoad area of the form it finds a specific record using:
Set rs = Me.Recordset.Clone
rs.FindFirst stlinkcriteria
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
My problem is that I only want this code in the OnLoad area (along with some
other coding) to run if I click the second button. I don't want to run the
code if it is simply going to a new record. Is there some way to check if the
DoCmd.OpenForm command that is run used the acNewRec option or not? Or
perhaps I am going about this in the wrong way. I checked the
me.form.newrecord, but either way it came back with a 0. Any help would be
greatly appreciated...