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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi..I have created an "Add new Reco

Status
Not open for further replies.

ReineM

Technical User
Jul 22, 2002
11
US
Hi..I have created an "Add new Record" command button on a form and it doesn't work. It adds the records to the table, but they do not show up in the form view after I close and restart Access. They will not come up on a record search in the form either. I can, however, add a new record by using the record navigation buttons at the bottom of the form. The form has subforms in it, but the command button is part of the main form and not the subforms. I cannot figure out what the problem is. I have a similar database that I used the "Add New Record" command button on and it works fine. The code for both appear identical:

Private Sub cmdAddPatient_Click()
On Error GoTo Err_cmdAddPatient_Click


DoCmd.GoToRecord , , acNewRec

Exit_cmdAddPatient_Click:
Exit Sub

Err_cmdAddPatient_Click:
MsgBox Err.Description
Resume Exit_cmdAddPatient_Click

End Sub

I'd appreciate any ideas anyone has...thanks!
 
What is your main form's, Form, Data, RecordSource property set to, a table, a query, or an SQL statement?

And, again, same question for your subforms?

You might need to check your parent/child settings for your subforms and check the joins between the tables in question.

It sounds like you may have tried to create a new record that saves to one table without having it linked to a corresponding record in another table. Depending on what type of join you have between the tables, you may not see on your form a record from one table if it doesn't have a corresponding record in the related table.

It isn't that the record doesn't exist or hasn't been saved, but, that the form needs to have related records in more than one table because of the join type between your tables.
lastout (the game's not over till it's over)
 
Thanks...that helped me track down the problem. My form was set to a query. The join type was incorrect between the tables in my query...as soon as I changed that all records showed up in the form and the Add New Patient button works. I appreciate your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top