Several questions

E

Eva Shanley

I have a form that contains a subform; on the main form is
Customer and Customer location, subform contains Line #,
Invoice #, Payment.
1. When creating a new record I want the Customer field
to be selected; tab order doesn't seem to give me what I
need. The selected field in the new record is whatever
field I was in when I entered the previous record. How
can I fix this?
2. The Invoice # is automatically generated when the Line
# is keyed in (code below). If a user needs to go back to
a previous record and add another Line #, I need the
Invoice # on that record to fill in, not the DMAX from the
table. Help? Thanks for any help I can get.

Private Sub InvoiceNumber_LostFocus()
If [LineNumber] = 1 And NewRecord Then
[InvoiceNumber] = DMax("InvoiceNumber", "tbl Rents") + 1
Else

[InvoiceNumber] = DMax("InvoiceNumber", "tbl Rents")
End If
End Sub
 
E

Eva Shanley

Thanks, that's just what I needed for the first question!
-----Original Message-----
Sugesstion for Q1.
On the On Current Event add Customer.Setfocus
-----Original Message-----
I have a form that contains a subform; on the main form is
Customer and Customer location, subform contains Line #,
Invoice #, Payment.
1. When creating a new record I want the Customer field
to be selected; tab order doesn't seem to give me what I
need. The selected field in the new record is whatever
field I was in when I entered the previous record. How
can I fix this?
2. The Invoice # is automatically generated when the Line
# is keyed in (code below). If a user needs to go back to
a previous record and add another Line #, I need the
Invoice # on that record to fill in, not the DMAX from the
table. Help? Thanks for any help I can get.

Private Sub InvoiceNumber_LostFocus()
If [LineNumber] = 1 And NewRecord Then
[InvoiceNumber] = DMax("InvoiceNumber", "tbl Rents") + 1
Else

[InvoiceNumber] = DMax("InvoiceNumber", "tbl Rents")
End If
End Sub
.
.
 

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