populate to subform

R

Revned

hi,
i have an unbound textbox [InvNo]
with a default value of =DMax("[Invoicenumber]","tblOrders")+2

i want that the value from my textbox [InvNo] be populated in my my subform
my subform property is set to Data Entry to Yes
my subform has a SQL record source from a query
can anyone is kind to help me on how to accomplish this?

thank you very much
 
J

John W. Vinson

hi,
i have an unbound textbox [InvNo]
with a default value of =DMax("[Invoicenumber]","tblOrders")+2

i want that the value from my textbox [InvNo] be populated in my my subform
my subform property is set to Data Entry to Yes
my subform has a SQL record source from a query
can anyone is kind to help me on how to accomplish this?

thank you very much

If you want this value to be assigned as a "custom autonumber", when a new
record is created, use the subform's BeforeInsert event:

Private Sub Form_BeforeInsert()
Me!Invoicenumber = NZ(DMax("[Invoicenumber]","tblOrders")) + 2

The +2 will cause alternating numbers to be inserted - 2, 4, 6, etc. - I'm
presuming that is what you want.
 
R

Revned

yes thank you for your help
but what i want is to populate the value coming from my textbox control
[InvNo]
to my subform
my [invNo] resides at my main form
i try using this [Order subform].Form.[InvNo] but no luck
it gives me #Name? error

hope you can help me again

thanks

John W. Vinson said:
hi,
i have an unbound textbox [InvNo]
with a default value of =DMax("[Invoicenumber]","tblOrders")+2

i want that the value from my textbox [InvNo] be populated in my my subform
my subform property is set to Data Entry to Yes
my subform has a SQL record source from a query
can anyone is kind to help me on how to accomplish this?

thank you very much

If you want this value to be assigned as a "custom autonumber", when a new
record is created, use the subform's BeforeInsert event:

Private Sub Form_BeforeInsert()
Me!Invoicenumber = NZ(DMax("[Invoicenumber]","tblOrders")) + 2

The +2 will cause alternating numbers to be inserted - 2, 4, 6, etc. - I'm
presuming that is what you want.
 
J

John W. Vinson

yes thank you for your help
but what i want is to populate the value coming from my textbox control
[InvNo]
to my subform
my [invNo] resides at my main form
i try using this [Order subform].Form.[InvNo] but no luck
it gives me #Name? error

What is the Master Link Field and Child Link Field of your subform? What in
fact are the primary keys of the two tables?
 

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