Hello!
I'm resorting to the Forum to ask me a question about the automatic completion of fields in a form, based on a combo box.
I have a table called TabClient with the following fields and columns in this order:
Client_ID => First Column = AutoNumber (Primary Key).
Number_Security => Second Column = Short Text.
Full_Name => Third column = Short Text.
Phone => Fourth column = Short Text.
Mobile => Fifth column = Short Text.
Whatsapp => Sixth column = Short Text.
And I have a form called Frm_CadServ with the following fields:
cboProp => Combo box that receives data from an SQL query (SELECT TabClient.Full_Name, TabClient.Number_Security FROM TabClient ORDER BY TabClient.Full_Name and displays only the Full_Name in it.
txtReq => Text box.
txtPhone => Text box.
txtMobile => Text box.
txtWhatsapp => Text box.
In the After updating event of txtReq, I put this code:
When I run it, I get the message "Runtime error 3075. Syntax error in string in query expression 'Phone='".
I already looked for the solution in some forums, I tried several expressions, but none worked.
Does anyone know what I'm doing wrong?
I'm resorting to the Forum to ask me a question about the automatic completion of fields in a form, based on a combo box.
I have a table called TabClient with the following fields and columns in this order:
Client_ID => First Column = AutoNumber (Primary Key).
Number_Security => Second Column = Short Text.
Full_Name => Third column = Short Text.
Phone => Fourth column = Short Text.
Mobile => Fifth column = Short Text.
Whatsapp => Sixth column = Short Text.
And I have a form called Frm_CadServ with the following fields:
cboProp => Combo box that receives data from an SQL query (SELECT TabClient.Full_Name, TabClient.Number_Security FROM TabClient ORDER BY TabClient.Full_Name and displays only the Full_Name in it.
txtReq => Text box.
txtPhone => Text box.
txtMobile => Text box.
txtWhatsapp => Text box.
In the After updating event of txtReq, I put this code:
Code:
Me.txtPhone = DLookup("Phone", "TabClient", "Phone=" & Me!cboProp.Column(4) & "'")
Me.txtMobile = DLookup("Mobile", "TabClient", "Mobile=" & Me!cboProp.Column(5) & "'")
Me.txtWhatsapp = DLookup("Whatsapp", "TabClient", "Whatsapp=" & Me!cboProp.Column(6) & "'")
When I run it, I get the message "Runtime error 3075. Syntax error in string in query expression 'Phone='".
I already looked for the solution in some forums, I tried several expressions, but none worked.
Does anyone know what I'm doing wrong?