Office & Productivity Software forum

General discussion

Need Access to set a field value depending on another value

by badboytimz / April 27, 2006 5:02 AM PDT

I am trying to help a temp doing data entry into an Access 2000 database, running under Windows XP. Is there a way to have the values in one field set if a value is chosen in a pull down list? Say the first field is department, can the value "dept. manager name" be populated in another field? Thanks.

Discussion is locked
You are posting a reply to: Need Access to set a field value depending on another value
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: Need Access to set a field value depending on another value
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Collapse -
Re: automatic filling of fields
by Kees Bakker / April 27, 2006 7:33 AM PDT

What I would do:
- make the dept manager name field a display only field
- add some VBA-code to the onchange event of the dept field.
What that code should do:
if the dept field is null: make the dept manager name field null also
if the dept field isn't null: do a dlookup to find the dept managers name and put it in the other field.


With a combobox/pull down list to choose the dept, there's another way, I think: add the manager's name to the query underlying the combobox and use that value in your VBA-code. Anyway, that's what I think, but I would have to experiment a little bit to sort out the details or find code in one of my applications that does this. So I'll leave that part to you. It's more elegant and faster, provided there is a pull-down list.

There might be example code in the Northwind database.

Kees

Collapse -
Thanks for the ideas. . .
by badboytimz / April 27, 2006 3:23 PM PDT

I was also thinking along the lines of running an update query maybe thru a macro from the 'lost focus' control from the Department pull down menu! I am getting ready to experiment now! Thanks!

Popular Forums
icon
Computer Newbies 10,686 discussions
icon
Computer Help 54,365 discussions
icon
Laptops 21,181 discussions
icon
Networking & Wireless 16,313 discussions
icon
Phones 17,137 discussions
icon
Security 31,287 discussions
icon
TVs & Home Theaters 22,101 discussions
icon
Windows 7 8,164 discussions
icon
Windows 10 2,657 discussions

Does BMW or Volvo do it best?

Pint-size luxury and funky style

Shopping for a new car this weekend? See how the BMW X2 stacks up against the Volvo XC40 in our side-by-side comparison.