DMax not working on form but OK in VBA

J

Jesse Avilés

I have the following expression:
DMax("
[intInvDetID] ", "tblInvoiceDetails", "[lutxtInvoiceID]="
& "'" & [Forms]!frmInvoice![txtInvoiceID] & "'") + 1

as the default value property. My problem is that get a
#Error on the field. I used the Immediate window in VBA
to check the expression and it returns the correct
value.

Jesse Avilés
monk @ coqui . net
 
P

Perry

Any reason to include a where statement in DMax() ?
Does the invoice number you want to increment, have a specific
criterium it has to meet?

I think below DMax statement in the defaultvalue property
of the form will suffice:

DMax("intInvDetID ", "tblInvoiceDetails")

Krgrds,
Perry

"Jesse Avilés" <[email protected]> schreef in bericht
I have the following expression:
DMax("
[intInvDetID] ", "tblInvoiceDetails", "[lutxtInvoiceID]="
& "'" & [Forms]!frmInvoice![txtInvoiceID] & "'") + 1

as the default value property. My problem is that get a
#Error on the field. I used the Immediate window in VBA
to check the expression and it returns the correct
value.

Jesse Avilés
monk @ coqui . net
 
J

Jesse Avilés

Yes

The setup of the table contains to fields, one relates
the child table to the parent table, and the other is the
line number of the child table. By themselves, both
field values repeat each other throughout the table,
together they are the primary key.

////////////
lutxtInvID - - - - intLineNo
01001 1
01001 2
01001 3
01002 1
01002 2
///////////
This is where the WHERE clause comes, I want to increase
the value for the currently open Invoice.

Jesse Avilés
 

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