Solved

Access - DLookup in Query?

Posted on 2007-11-19
1
406 Views
Last Modified: 2010-05-19
Hi,
Is there anyway to look up a value from a text field on one of my forms from a query? I dont know if this can be done via DLookup or something? An example would be;

Select DateUpdated from tblDate Where DateUpdated = #Forms!frmAddData!TextDate.Value#

Thanks
0
Comment
Question by:andyb7901
1 Comment
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 20311447
Your command is essentially correct but it needs adjusting depending on where you are running the query,
If this is a saved query you can omit the # #.

If you are using it for a recordset in code then you need something like:

dim strsql
strsql = "Select DateUpdated from tblDate Where DateUpdated = #" & Forms!frmAddData!TextDate.Value & "#"
set rs = db.openrecordset(strsql)

If you still can't sort it out then post back and explain what you are trying to do.



0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

816 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

7 Experts available now in Live!

Get 1:1 Help Now