Command Button to Populate Subform Table

carter1367

New member
Local time
Today, 11:33
Joined
Nov 1, 2009
Messages
6
I have a customer database form with a subform of transactions. I would like to put a command button on the main form to populate a new record on the subform. My goal is to automatically add vouchers of a specific amount without having to enter the data.

Any help would be much appreciated

Thank you
 
to do that, you are best firing an append query

sqlstrg = "insert into subtable (field1,field2,field3) select value1,value2,value3"
docmd.openquery sqlstrg
(or currentdb.execute sqlstrg)

then requery the subform, and your new record will be displayed.

But you need to be prescise in the construction of the "insert into " string
 
This code will add a blank record. I guess you can code around to set the billing amounts

SubFormControlName.SetFocus
SubFormControlName.Form!FieldInSubform.SetFocus
DoCmd.GoToRecord , , A_NEWREC
 
Thank you for the replies. Urm, not to sure how to code either of them though. Any examples would be great, or a link to any sample databases.

Thank you
 

Users who are viewing this thread

Back
Top Bottom