473,326 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Updating a text box from data in a combobox

I have 2 tables:

tblRegluarCustomers: ID, Name, Address, etc
tblSales: InvNum, custID, Name, Address,etc

(I decided to duplicate the Name and Address field in the sales table because many customers are only 1 time visitors, so I don't want to add them to my regular customers table)


My form has a combo box that allows the user to choose a regular customer and the customer ID is stored in the custID field.

My dilemma is that I want the regular customer's Name, Address etc to be displayed on the form when I select a customer from the combo box. If I don't select a customer I can just input the name myself.

thanks in advance
bushrat

Attached Images
File Type: jpg sales-form.jpg (41.5 KB, 174 views)
Apr 7 '15 #1
3 1188
Rabbit
12,516 Expert Mod 8TB
It's very common to store the addresses again in an order table because customers move around or use different shipping addresses from time to time.

How familiar are you with VBA? You'll need to use VBA coding to do this.

Basically, what you will need to do is use the On Update event of the customer combo box to pull the address info from the customers table using a function like DLookup().
Apr 7 '15 #2
Thanks, I thought i would have to use VBA. I got an Ebook the other day so I'll get onto that :)

I was thinking outside the box and came up with a temp solution:

I inserted some combo boxes that are related to the custID and set their visibility property to false. When a regular customer is selected I run a macro that makes the combo boxes visible and makes the other text boxes invisible. Thus displaying the customer details.

I when I save the record I can run an update query that updates the other fields in the sales table. Bit convoluted but it is working for now:

Apr 10 '15 #3
Rabbit
12,516 Expert Mod 8TB
Glad you found a workaround. While macros can often accomplish the same things as VBA code, it is not as powerful. So it is well worth the effort to learn VBA because it unlocks so much more you can do in Access.

If you run into any problems with the code, please post it here with the error message and we can help you fix it.
Apr 10 '15 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Stephen Saunders | last post by:
Hey Folks, This one currently has me stumped. I have to check for the existence of a carriage return (Enter key, hex 0D) in text data. First I tried: 'Check comment to not contain the CR...
1
by: Peter Zentner | last post by:
Hi all, is there a chance to append the text of the new selected item to the text in the textbox portion of the control? Example: textbox: "hello " new selected item: "world" new textbox...
5
by: adrian | last post by:
hi all this is my first post to this group, so pls bear with me while i try to make some sense. i am trying to create a sproc which uses dynamic sql to target a particuar table eg. '.' and...
1
by: Adnan Jamil | last post by:
Hi Guys, I have editing a SQL Server table field that have long text data. I am updating some text in this field. How can I update this field instead of re-write all text. With the Select...
1
by: Ola Theander | last post by:
Dear subscribers I'm currently creating a small application that will run at the end of a web installation to configure a SQL Server. For this task I have a SQL batch file in the same format...
9
by: Susan Bricker | last post by:
Greetings. I am having trouble populating text data that represents data in my table. Here's the setup: There is a People Table (name, address, phone, ...) peopleID = autonumber key There...
6
by: smilly | last post by:
This field is bound to a image data type in SQL server that is used to house big amounts of text how can I output the text data because right now I am getting System.Byte
5
by: sirimanna | last post by:
hello, i'm new to VB...i like to know how to open some text data save in c: in to text box.. i know to save cord's to save data in text box in to c:..but i don't know how to get back that save...
4
by: parkergirl | last post by:
Hello, I am currently working on a project that has many tabs all on one form. Since you can only have so many controls on one form, my job is to seperate these tabs into forms. One problem that I...
9
by: sillyr | last post by:
Hi - I use Access 2007. I have a two data fields that I would like to add together in a query and then have the query sum the data for the entire table. The problem is that one of the data fields...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.