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!

Add new record problem

Status
Not open for further replies.

drikoudis

Programmer
Nov 1, 2003
53
GR
Hello to all, i have a main form "PATIENT" and a subform "VISIT" into the "PATIENT". In the "PATIENT" i have a button and i want when i click it, to add a new record in both forms.
Thanks John.
 
Hi,

I am assuming that the tables in your patient and visit forms are linked somehow PATIENT<->VISIT 1:M relationship?

If that is the case then you need to bear in mind the following - it is easy to do so these pointers should help you.

1) The record will need to be entered into the parent table PATIENT first - this may seem obvious, but Access is a pain at reporting errors at times.
2) Once the record has been added to your main form then you need to select it somehow - look at RowSource on your main for,
3) Once the record is displayed then you can get your PK from the main form - this will be used as the base for the sub form presumably. Once you have this value then it is a simply case to add the record to your secondary table and refresh the sub form.

Hope this helps.

Andrew
 
Dear afryer , you got the point !! I have PATIENT<->VISIT 1:M and i take those errors. I can unterstand what you say but thanks.

John.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top