[AccessD] FindFirst Error

Dale Kalsow dkalsow at yahoo.com
Wed May 23 13:30:40 CDT 2012


The entire field is defined as a string in the table.  Also, the first time around (when the table is empty) the first record is created without an error.



________________________________
From: Rocky Smolin <rockysmolin at bchacc.com>
To: 'Access Developers discussion and problem solving' <accessd at databaseadvisors.com> 
Sent: Wednesday, May 23, 2012 1:23 PM
Subject: Re: [AccessD] FindFirst Error

I think you have to put # before and after the date:  strkey = "#"&
5/21/2012 & "#"

HTH

Rocky Smolin
Beach Access Software
858-259-4334
www.bchacc.com
www.e-z-mrp.com
Skype: rocky.smolin



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dale Kalsow
Sent: Wednesday, May 23, 2012 11:14 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] FindFirst Error

Good Afternoon Everyone,
 
I have the following code that is giving me a Run-time error '3077' Syntax
error (missing operator) in expression. on the FindFirst line.  Can anyone
see why? strkey = 5/21/2012Heather Hanson
 
Is access not liking the space in field?
 
Thanks!
 
Set dbsDB = DBEngine(0)(0)
    Set rstRS = dbsDB.OpenRecordset("tblEmployeeTimes", dbOpenDynaset)
    Set rstRsNew = dbsDB.OpenRecordset("qryKeyCardImport", dbOpenDynaset)
    
    rstRsNew.MoveFirst
    
    Do While Not rstRsNew.EOF
        strKey = Format(rstRsNew![Time], "Short Date") &
Trim(rstRsNew![Employee])
        rstRS.FindFirst "[EmployeeTimesID] = " & strKey

        If not rstRS.NoMatch Then
                With rstRS
                    .Edit
                    rstRS![EmployeeTimesOut] = Format(rstRsNew![Time],
"Medium Time")
                    .Update
                End With
         Else
                With rstRS
                    .AddNew
                    rstRS![EmployeeTimesID] = strKey
                    rstRS![EmployeeTimesDate] = Format(rstRsNew![Time],
"Short Date")
                    rstRS![[EmployeeTimesName]] = Trim(rstRsNew![Employee])
                    rstRS![EmployeeTimesIn] = Format(rstRsNew![Time],
"Medium Time")
                    .Update
                  End With
            End If
            rstRsNew.MoveNext
            
        Loop
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


More information about the AccessD mailing list