Open form event

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I open a form with the following code

DoCmd.OpenForm "frmForm", , , , acFormAd

because I would like to add a new client and don't need to see other records
But once the record is committed, I would still like to add additional information. The form goes to a new record and I can't access the record I just added. Is acFormAdd not appropriate here
Thanks so much!
SMK
 
I just double checked. When I open a form with acFormAdd, it goes to a new
record. When I enter the new record and move on, it again goes to a new
record, but the records I've entered during that session are still available
by going backwards using the record selectors. I tried setting AllowEdits to
no then opening the form with the code and still get the same thing.
AllowEdits gets set back to Yes by acFormAdd.

--
Wayne Morgan
Microsoft Access MVP


smk2 said:
I open a form with the following code:

DoCmd.OpenForm "frmForm", , , , acFormAdd

because I would like to add a new client and don't need to see other records.
But once the record is committed, I would still like to add additional
information. The form goes to a new record and I can't access the record I
just added. Is acFormAdd not appropriate here?
 
I open a form with the following code:

DoCmd.OpenForm "frmForm", , , , acFormAdd

because I would like to add a new client and don't need to see other records.
But once the record is committed, I would still like to add additional information. The form goes to a new record and I can't access the record I just added. Is acFormAdd not appropriate here?
Thanks so much!!
SMK

Why not just open the 2nd form normally.
DoCmd.OpenForm "FormName"

Code the Load event of the 2nd form:
DoCmd.RunCommand acCmdRecordsGoToNew

It will open at a new record, but all other records are available as
well.

Or if this is just an ocassional thing, where it's only from one form
that you wish to go directly to adding a new record, code the command
button click event:
DoCmd.OpenForm "FormName", , , , , , "GoToNew"

Then code the Load event of the 2nd form:
If Me.OpenArgs = "GoToNew" Then
DoCmd.RunCommand acCmdRecordsGoToNew
End If

Only when opened from this first form will it go directly to a new
record.
 
Thanks so much for the input
I previously opened the form and went to a new record. But that pulls 40,000 records and I have no need for those other records. My temporary fix is to pull records entered after a certain date. But with this particular form, I just want to add a new entry

My backend is SQL server and I'm having issues with two tables joined and generating new records in each of those tables. That is why there is code on the form to commit the edit. But once I do so, I can't move back to that record. My record selectors don't show any other records other than a new one without data

It just seems like this is harder than it should be
Appreciate the good help!
SMK
 
Back
Top