pass dlookup value to a text field.

Posted on 2004-11-07
Last Modified: 2008-02-20
experts, here's my code for the afterupdate event Combo0 in my form and after update I have a blank field for textbox "PM".

Private Sub Combo0_AfterUpdate() = DLookup("Hours", "qr", "Forms![Form1].[Group]='PM")
End Sub

the requery is to run query "qr" whose criteria depends on the value of the above combo box.

Am I doing something similar to a circular formula here? If so, please help
Question by:mc7560
    LVL 12

    Accepted Solution

    Your criteria is not quite right.

    You have the first two parts right, but you have to tell Access which field in the query qr you want to set the criteria on.  So you should have something like:

    DLookup("Hours","qr","SomeFieldIn_qr=" & forms!Form1!Combo0)

    If that doesn't help, post here with some more details, in particular the SQL from query qr and the field you want to filter it by.
    LVL 33

    Expert Comment

    by:Mike Eghtebas
    ' is missing from 'PM' = DLookup("Hours", "qr", "PM = '" & Forms![Form1].[Group] & "'")

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
    A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
    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…
    With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

    734 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

    17 Experts available now in Live!

    Get 1:1 Help Now