Solved

Retrieving value from txtbox that gets its value from a dlookup statement

Posted on 2013-01-30
1
234 Views
Last Modified: 2013-02-04
I have an access form that populates a text field based on a "dlookup" statement, whenever a combo box changes.  I need to get the value in that text field when it is filled (e.g. Yes/No).  Whenever I look at the value of this field in debug mode, it is "null", so I cannot branch on its value to do something else on the form.  Not sure how to handle this.

What I would like to do is this.
1. - select a value from a combo box
2. - have this value in the field be updated with a yes / no from the database table
3. - If it's a "yes", populate another combo box with certain values, or, if it is a "no", populate the other combo box with different values.

Thanks..Tom
0
Comment
Question by:tpigielski
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 38838100
What combo event are you using for this?  Change Event?  After Update Event?

The After Update event would be the better choice.

In the after update event of your combo box, try this:


Private Sub Combo_AfterUpdate()
       Dim sValue as string
       sValue = DLookup("YourField", "YourTable", etc)

       if sValue = "Yes" then
              ' do something
       else
             ' do something else
       end if
end sub

Open in new window


You'll have to fill in the details for the DLookup statement.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question