Solved Automatically bring customer data (1 Viewer)

FahadTiger

Member
Local time
Today, 02:42
Joined
Jun 20, 2021
Messages
115
Hi Expert..
I have a sales form..when I type the customer's name..it brings me the address and mobile number automatically
And when its not exit...I will enter the address and mobile phone in their respective text boxes and they are added to the customers table
Any Advice
 

Attachments

  • invoice1.accdb
    1.2 MB · Views: 59

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 18:42
Joined
Feb 28, 2001
Messages
27,193
Your description is not clear. What is the desired event or sequence of events, and what do you want to happen. You have to remember that a lot of us old folks are VERY literal minded and you have to almost paint us a picture. Seeing your code doesn't help (yet) because obviously what you showed us doesn't do whatever you wanted; otherwise, you would never have asked the question.
 

Cronk

Registered User.
Local time
Today, 09:42
Joined
Jul 4, 2013
Messages
2,772
In the Update event of the combo, look up the values of Address and Mobile and insert values in the unbound text boxes.

Better if you based the form's source on a query which combined the Sales and Customer details.

For getting the address and mobile for a new customer, I'd have a separate pop up form for the user to enter the new data.
 

Eugene-LS

Registered User.
Local time
Today, 02:42
Joined
Dec 7, 2018
Messages
481
I will enter the address and mobile phone in their respective text boxes and they are added to the customers table
If I understood you correctly, something like this:
 

Attachments

  • invoice_v03.zip
    30.7 KB · Views: 75

Gasman

Enthusiastic Amateur
Local time
Today, 00:42
Joined
Sep 21, 2011
Messages
14,317
Why not have a combo for customer names and bring in other details in the combo source, then just refer to the extra columns?
 

FahadTiger

Member
Local time
Today, 02:42
Joined
Jun 20, 2021
Messages
115
If I understood you correctly, something like this:
Thank you very much for the quick response
Yes, this is exactly what I want..I knew how to get customer data by querying..My problem was with adding the address or phone number..I used the RunSQL method.
But it works wrong
.
DoCmd.RunSQL "INSERT INTO CustomerT ([Address] )VALUES (" & txtAddress & ") WHERE customerID=" & Nz(Me.CustomerName, 0) & ";"
 

Gasman

Enthusiastic Amateur
Local time
Today, 00:42
Joined
Sep 21, 2011
Messages
14,317
You need single quotes around your txtAddress and no need for the ";"
I would also use Me.txtAddress ?
I always put the sql string into a string variable so I can debug.print it to ensure it is correct, then use that in the command.
 

Users who are viewing this thread

Top Bottom