Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2013-01-30
1
Medium Priority
?
236 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 2000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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 …

618 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