0
votes

I am setting up a database and one of my OpenForm commands is giving a data type mismatch error for the criteria expression. All of the fields involved are formatted as text so I don't know what's causing the error.

I have tried changing the data types of the fields but it hasn't solved the issue.

 DoCmd.OpenForm "frm_InvoiceInfo", acNormal, , "[Invoice#] = " & Me.txtInvNum

When txtInvNum is clicked then it should open frm_InvoiceInfo and set the Invoice# field to equal the clicked value.

1

1 Answers

0
votes

If, as you state, your fields are all text values, you should enclose the criteria with single or double quotes, e.g.:

DoCmd.OpenForm "frm_InvoiceInfo", acNormal, , "[Invoice#] = '" & Me.txtInvNum & "'"

Or:

DoCmd.OpenForm "frm_InvoiceInfo", acNormal, , "[Invoice#] = """ & Me.txtInvNum & """"