I have been forced to change the data type of a field which I use to find records on a subform (too complicated to explain, but not uncommon for my employer to change their mind about what they want) from number to text to allow the use of alphanumeric codes. This has now produced a problem in searching the database.
The field in question lives in a table called tblOrders1 and holds the (manually generated, again dont ask) order number for that order ([OldOrderNumber]). The information from this table is displayed in a subform, which is on a mainform which holds client contact information.
My search function runs from a form launched from my switchboard (frmFindOrder) which prompts for an order number and then opens the mainform at the client record which 'owns' that order. When I was just using numbers things were fine but now I have to use the format R### or T### or C### for order numbers depending on what the order is for.
This code worked fine before:
the sub continues with a section to move the subform to the right record.
This code now breaks instantly producing the following error if I try to find order T66 say:
Type Mismatch
Obviously I've got some sort of syntax error but I'm buggered if I can find it - something to do with the quotes in the DLookup expression I think. I do need some help with this one - if you've got any ideas I'll be happy to hear them.
Robbo ;-)
The field in question lives in a table called tblOrders1 and holds the (manually generated, again dont ask) order number for that order ([OldOrderNumber]). The information from this table is displayed in a subform, which is on a mainform which holds client contact information.
My search function runs from a form launched from my switchboard (frmFindOrder) which prompts for an order number and then opens the mainform at the client record which 'owns' that order. When I was just using numbers things were fine but now I have to use the format R### or T### or C### for order numbers depending on what the order is for.
This code worked fine before:
Code:
Public....
dim intCustomer as integer
dim intOrderNum as integer
intOrderNum = me!txtOrderNum 'The control on the search form
intCustomer = DLookup("CustomerID","tblOrders1",&_
"OldOrderNumber =" & intOrderNum
DoCmd.OpenForm "frmContactInformation",,,"[CustomerID] =" & intCustomer
DoCmd.Close acForm, "frmFindOrder"
the sub continues with a section to move the subform to the right record.
This code now breaks instantly producing the following error if I try to find order T66 say:
Type Mismatch
Obviously I've got some sort of syntax error but I'm buggered if I can find it - something to do with the quotes in the DLookup expression I think. I do need some help with this one - if you've got any ideas I'll be happy to hear them.
Robbo ;-)