Find First

S

Stonewall

I have a student profile form with a field called last date of attendance. I
want this field to be populated on open with the last date attended by the
student displayed on the form. Access 2003.

I put this syntax on the control source property of the last date of
attendance text box but no go.

=FindFirst([[date.].[attendance_clock_in], "Student ID" = employeeid)

[Date] is the field in the [attendance_clock_in table I want to retrieve.
StudentID is the field from the attendance_clock_in table that contains the
student id I am looking for.

EmployeeId is the text box on the form that contains the student id that is
currently displayed on the form.

Thanks for any help.
 
J

John W. Vinson/MVP

Stonewall said:
I have a student profile form with a field called last date of attendance.
I
want this field to be populated on open with the last date attended by the
student displayed on the form. Access 2003.

I put this syntax on the control source property of the last date of
attendance text box but no go.

=FindFirst([[date.].[attendance_clock_in], "Student ID" = employeeid)

[Date] is the field in the [attendance_clock_in table I want to retrieve.
StudentID is the field from the attendance_clock_in table that contains
the
student id I am looking for.

EmployeeId is the text box on the form that contains the student id that
is
currently displayed on the form.

Well, several problems here.

For one, Date is a reserved word (for today's date) and a bad choice of
fieldname. For another, the syntax of FindFirst doesn't even vaguely
resemble what you posted; type Ctrl-G and choose Help and search for Help on
the FindFirst method for details. It's a method of a Recordset, not a
function.

Another problem is that you have field.table, the correct syntax is
table.field; also, you have a fieldname containing blanks, which must be
delimited by brackets.


I think that you would be better served by using the DLookUp function
instead. Try
=DLookUp("[Date]", "[attendance_clock_in]", "[Student ID] = " &
[EmployeeID])
 
S

Stonewall

Thanks for the info. Will the Dlookup statement return the last date in the
table for that student or the first? I need the last.

John W. Vinson/MVP said:
Stonewall said:
I have a student profile form with a field called last date of attendance.
I
want this field to be populated on open with the last date attended by the
student displayed on the form. Access 2003.

I put this syntax on the control source property of the last date of
attendance text box but no go.

=FindFirst([[date.].[attendance_clock_in], "Student ID" = employeeid)

[Date] is the field in the [attendance_clock_in table I want to retrieve.
StudentID is the field from the attendance_clock_in table that contains
the
student id I am looking for.

EmployeeId is the text box on the form that contains the student id that
is
currently displayed on the form.

Well, several problems here.

For one, Date is a reserved word (for today's date) and a bad choice of
fieldname. For another, the syntax of FindFirst doesn't even vaguely
resemble what you posted; type Ctrl-G and choose Help and search for Help on
the FindFirst method for details. It's a method of a Recordset, not a
function.

Another problem is that you have field.table, the correct syntax is
table.field; also, you have a fieldname containing blanks, which must be
delimited by brackets.


I think that you would be better served by using the DLookUp function
instead. Try
=DLookUp("[Date]", "[attendance_clock_in]", "[Student ID] = " &
[EmployeeID])
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top