Solved

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

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
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…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

730 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