
FindFirst syntax 2.0 to 97 ?
On Tue, 26 Nov 2002 09:18:31 -0600, "97 User"
Quote:
>After a crash course in DAOs, it seems like only the following two* lines
>are failing in my module.
>Set RS = DB.OpenRecordset("qryTimeClockDay")
>* RS.FindFirst "employed=" + GetEmployeeID(UserID) + "AND IsNull(Time_Out)"
>* If RS.NoMatch Then....
> (employed, example 91, was found during a previous jump to function
>GetEmployeeID; qryTimeClockDay doesn't contain a UserID & does contain a
>Time_Out)
You're missing a blank. If the function returns 91 this query string
will be
employed = 91AND IsNull(Time_Out)
91AND is, of course, nonsensical to Access.
Also, in a Query, you should probably use the IS NULL operator rather
than the IsNull() function: try
RS.FindFirst "employed=" + GetEmployeeID(UserID) + " AND Time_Out IS
NULL"
in order to find those records where [Employed] - a Number field -
contains the numeric value returned by the function and where the
Time_Out field contains nothing. (If that's not what you're trying to
find post back!)
I'm not at all certain what you're trying to find here.
Quote:
>Should the (UserID) be a value I can try to display?
Yes. It needs to be a text string to build the SQL; it should
correspond to a legitimate value in the field [Employed]. If
GetEmployeeId returns a null or empty string, you'll need to trap that
event - perhaps the function should be written to return 0 or some
other value that never corresponds to a real record.
Quote:
>Everything after the above lines* work when they are commented out. I can't
>find
>a similar enough example to help me. Examples of NoMatch like
>(blank).NoMatch, fail,
NoMatch is a property of a Recordset object. It's True if the
recordset has no data, False if there is data. I'm not sure what you
mean by the previous sentence.
Quote:
>Could the FindFirst problem be with the AND?, the +'s?, should I use &'s?
>This code worked perfect in 2.0, not in Jet 3.5.
I'm sorry, but I think the code has gotten garbled in between. This
could never have worked, not as you have posted it!
John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public