A "Add Person" command doesn't.

G

Guest

frmPerson is based on qryPerson
'Add Person' has following code, which does update tblPeople--by overwriting the first record
How do I get it to generate a new record

Private Sub cmdAddPerson_Click(
On Error GoTo Err_cmdAddPerson_Clic
DoCmd.GoToRecord , , acNewRe
'make everything visible

DoCmd.Requery qryPeopleAddNe
Exit_cmdAddPerson_Click
Exit Su

Err_cmdAddPerson_Click
MsgBox Err.Descriptio
Resume Exit_cmdAddPerson_Clic

End Su
 
S

Sandra Daigle

If you want to 'goto' a new record so the user can enter it then you just
remove the docmd.requery statement. Is this what you want or are you trying
to programmatically create the record?
 
G

Guest

When I just had the 'goto new record' command, I got a blank record into which I could enter data--but it didn't get entered into the table. It evaporated after entry.
 
G

Guest

Yes, I checked the table.
I'm now have 2 command buttons, one does "DoCmd.GoToRecord,,acNewRecord" bit
The 2nd would run an update query.
Currently the update query is complaining about not having "orgID" (it does have it)
 
S

Sandra Daigle

Ok is the first button working now?

Post the SQL for the query on the second button - also post the code that
executes the query along with any other description of what is on the form
and where it originates (what table etc.).
 
G

Guest

I've solved this one by creating a special "add person" form based on tblPeople which works. Used the wizard to create the code behind the button.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top