K
Karen
i have a form that i use as a dialog box. when the user enters a code in
the unbound control on the dialog form i want to search the table to see if
the code is found in there. IF the code is found, i want to open another
form and display some information about the reagent. If the code is not
found i want to display a message. I have the following code attached to
the 'OK' button on the dialog form. the problem with it is that
alphanumeric codes return an error message of Runtime Error '13': Type
Mismatch. in the reagents table, fldcode is text. [frm shelflife dialog
box]!Text0 has nothing in the format property. Numeric codes work
correctly.
'check to see if the code is in tblreagents
'if the code is found, display a message
If DLookup("[fldcode]", "tblReagents", "[fldcode] = Forms![frm shelflife
dialog box]!Text0") Then
'open the shelflife form
DoCmd.Minimize
DoCmd.OpenForm "frmshelflife", acNormal
'if not found
Else
'display a message
MsgBox "The code you entered is not valid", vbExclamation, "Code Not
Found"
Does anyone have any suggestions on how i can do this without the runtime
error?
Karen
the unbound control on the dialog form i want to search the table to see if
the code is found in there. IF the code is found, i want to open another
form and display some information about the reagent. If the code is not
found i want to display a message. I have the following code attached to
the 'OK' button on the dialog form. the problem with it is that
alphanumeric codes return an error message of Runtime Error '13': Type
Mismatch. in the reagents table, fldcode is text. [frm shelflife dialog
box]!Text0 has nothing in the format property. Numeric codes work
correctly.
'check to see if the code is in tblreagents
'if the code is found, display a message
If DLookup("[fldcode]", "tblReagents", "[fldcode] = Forms![frm shelflife
dialog box]!Text0") Then
'open the shelflife form
DoCmd.Minimize
DoCmd.OpenForm "frmshelflife", acNormal
'if not found
Else
'display a message
MsgBox "The code you entered is not valid", vbExclamation, "Code Not
Found"
Does anyone have any suggestions on how i can do this without the runtime
error?
Karen