How do I enter list into combo box for lookup?

glenn69

New member
Local time
Yesterday, 23:38
Joined
Dec 8, 2004
Messages
7
Hello,

I have a database filled with "jobs." Each "job" contains information and a "job Number."

I would like to, in a form using some sort of combo box, etc, enter a list of job numbers to make an identical change to.

Example : I would like to change the salesperson_name for job # 12345, 67543, 26873, 29873, 29879, and 28739 to "Fred." I would like to do this by entering a list of Job numbers and having those jobs' salesperson_name changed accordingly.

How would I do this? Keeping in mind that it needs to be somewhat user friendly because others will be using this form.

Thanks
 
Dynamically build the list. Loop through your combo box (probably a list box?) and add each selected item in it to a string. For example, if these are your job numbers:

12345
23456
34567
45678
56789

And the 1st, 3rd, and 5th are selected, then you'd build a string by looping through the list box to find the selected items to get this output in your string:

12345, 34567, 56789

It's then an update query:

CurrentDb.Execute "UPDATE YourTableName SET YourFieldName="Fred" WHERE JobNum In (" & YourStringOfJobNumbers & ");"

Note that if the job numbers are stored as strings, you'll need single quotes, like this:

'12345', '34567', '56789'
 

Users who are viewing this thread

Back
Top Bottom