Senin, 16 September 2013

RE: [MS_AccessPros] FindFirst method syntax

Phucon,
Please reply back with the significant field names and data types in the table "tblPled".

Duane Hookom MVP
MS Access


________________________________
> To: MS_Access_Professionals@yahoogroups.com
> From: saigonf7q5@yahoo.com
> Date: Mon, 16 Sep 2013 15:25:36 -0700
> Subject: [MS_AccessPros] FindFirst method syntax
>
>
>
>
>
>
> Hello
>
> The syntax in my FindFirst method (in orange color) generated this error:
>
> Error 3070 (the Microsoft Access database engine does not recognize
> 'a101' as a valid field name or expression)
>
>
>
> I thought it's correct as the other 2 (color in blue). If I remember
> correctly, I think I have seen it somewhere, either 1 is correct. Am I
> wrong?
>
>
>
> Phucon
>
>
>
> Private Sub cmdSave_Click()
>
> On Error GoTo ErrorHandler
>
>
>
> If IsNull(Me.txtsAcctID) Or IsNull(Me.txtsName) Then
>
> MsgBox "Acct ID and Name cannot be left blank."
>
> GoTo ExitProcedure
>
> End If
>
>
>
> Set db = CurrentDb
>
> Set rs = db.OpenRecordset("tblPled", dbOpenDynaset)
>
>
>
> 'rs.FindFirst "AcctId = " & Chr$(34) & Me.txtsAcctID & Chr$(34)
>
>
>
> rs.FindFirst "AcctId = " & "' & (Me.txtsAcctID) & '"
>
>
>
> ' rs.FindFirst "AcctId = " & "" & Me.txtsAcctID & ""
>
>
>
> With rs
>
> If .NoMatch Then
>
> .AddNew
>
> !sAcctID = Me.txtsAcctID
>
> !sName = Me.txtsName
>
> .Update
>
> .Close
>
> Else
>
> MsgBox "Cannot save record. This Acct ID already
> exist.", vbExclamation, "Invalid Account ID"
>
> GoTo ExitProcedure
>
> End If
>
> End With
>
> ExitProcedure:
>
> TempVars.Remove "DateIsBlank"
>
> Exit Sub
>
>
>
> ErrorHandler:
>
> MsgBox "Error " & Err.Number & " (" & Err.Description & ")
> in procedure cmdSave_Click"
>
> Resume ExitProcedure
>
> End Sub
>
>
>

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/MS_Access_Professionals/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/MS_Access_Professionals/join
(Yahoo! ID required)

<*> To change settings via email:
MS_Access_Professionals-digest@yahoogroups.com
MS_Access_Professionals-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
MS_Access_Professionals-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://info.yahoo.com/legal/us/yahoo/utos/terms/

Tidak ada komentar:

Posting Komentar