Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to go to a record with the current date in the date field 2

Status
Not open for further replies.

rew2009

Technical User
Apr 21, 2009
114
US
I have a table set up for a todo list with a date field “DATE111”. Records with dates run through the year 2010. When I open the form I want it to pull up and display the record for the current date.

I have the following code in the “On Open” event for the form “OrganizerToDoList”

Forms!OrganizerToDoList.Recordset.FindFirst "[DATE111]=" & Me.Text227.VALUE

Where ‘Me.Text227.VALUE’ has the current date, and 'OrganizerToDoList' is my form with only one table powering the form.

When I used the code I get the error:

The specified field ‘DATE111’ could refer to more than one table listed in the FROM clause of your SQL statement.

However, I have only one field named ‘DATE111’ in the ‘OrganizerToDoList’ table and the field ‘DATE111’ does not exist in any other table of the database.

I have also tried the following code and get the same error.

Me.Recordset.FindFirst "DATE111=" & date$

What am I doing wrong?

Thanks Russ
 
Hi rew,

What's in the record source of the form?

If it's a query - please post the SQL.

ATB

Darrylle

Never argue with an idiot, he'll bring you down to his level - then beat you with experience.
 
Thanks Darrylle,

I looked at my QRY and I had 'DATE111' in it twice. I removed one and do not get that error now.

However, the form does not go to the record with the current date. Again I am using the following code on open:

Me.Text227.VALUE = date$

Forms!OrganizerToDoList.Recordset.FindFirst "[DATE111]=" & Me.Text227.VALUE

What am I doing wrong?

Thanks, Russ
 
rew,

No prob - this problem is fixed.

In order that your problem title leads people to future fixes - you need to start a new thread - no?

I'm not being awkward, but you could include 100 issues from here on in, which would not help users looking for specific issues (as they would all be hidden within "Trying to go to a record with the current date in the date field").

Add a new thread - with a new title.

ATB

Darrylle

Never argue with an idiot, he'll bring you down to his level - then beat you with experience.
 

Since you're dealing with a Date/Time field here the correct syntax would be

Code:
FindFirst "[DATE111]= #" & Me.Text227.VALUE & "#"


The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top