Add new record in a sub form

S

Stapes

Hi

I have a Booking Form with 2 subforms - Customer Details & Booking
Details. I can find a Customer & get his details displayed in the
Customer Details section, and click a button on the Booking Details
subform which executes the following:

DoCmd.GoToRecord , , acNewRec

This works fine - I can enter details for a new Booking.

I also have an Enter/View Customers form in the system, and I am
trying to put a New Booking button on there which opens the Booking
Form with the selected Customer Details at the top and the Booking
Details sub form open to Add a new booking.

I tried executing the same code (DoCmd.GoToRecord , , acNewRec) in the
On Load section of the Booking Details sub form, and it reverts to
displaying the first record in the file. In the Customer Details
subform, if it detects that it has been called from the Enter/View
Customers form, the On Load event finds the selected Customer details
& displays them. This works fine if I don't add the On Load procedure
described above to the Booking Details subform.

Is there any way I can do this?

Stapes
 
S

Stapes

Hi

I have a Booking Form with 2 subforms - Customer Details & Booking
Details. I can find a Customer & get his details displayed in the
Customer Details section, and click a button on the Booking Details
subform which executes the following:

DoCmd.GoToRecord , , acNewRec

This works fine - I can enter details for a new Booking.

I also have an Enter/View Customers form in the system, and I am
trying to put a New Booking button on there which opens the Booking
Form with the selected Customer Details at the top and the Booking
Details sub form open to Add a new booking.

I tried executing the same code (DoCmd.GoToRecord , , acNewRec) in the
On Load section of the Booking Details sub form, and it reverts to
displaying the first record in the file. In the Customer Details
subform, if it detects that it has been called from the Enter/View
Customers form, the On Load event finds the selected Customer details
& displays them. This works fine if I don't add the On Load procedure
described above to the Booking Details subform.

Is there any way I can do this?

Stapes

Are my questions too hard for you all?
 
T

Tom Wickerath

Are my questions too hard for you all?

No, however, this attitude is a bit arrogant on your part. A likely reason
that no one has attempted to answer you is that your question is about as
clear as mud:

Keep in mind that no one, except you, can see your database or knows what
you are thinking. I suspect that you may need to use the DoCmd.Openform
method, using the optional WhereCondition parameter to supply the primary key
of the customer. But, you really need to rephrase your issue, so that it is
clearly written for mere mortals, like myself.


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 

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