Solved

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

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
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…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

757 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

22 Experts available now in Live!

Get 1:1 Help Now