populate to subform

  • Thread starter Thread starter Revned
  • Start date Start date
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
 
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.
 
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.
 
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?
 
Back
Top