DMax not working on form but OK in VBA

  • Thread starter Thread starter =?iso-8859-1?Q?Jesse_Avil=E9s?=
  • Start date Start date
?

=?iso-8859-1?Q?Jesse_Avil=E9s?=

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
 
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
 
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
 
Back
Top