Solved

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

Posted on 2013-01-30
1
229 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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…

914 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now