Solved

Access - DLookup in Query?

Posted on 2007-11-19
1
400 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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…

707 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