Hi there,
I have a main form and a subform, I trying a code in subform as below and
found a run-time error#3464 on the line of "Set rst =
db.OpenRecordset(strSQL)"
I am appreciate for your help in advance!!!!!
Private Sub LABOUR_NO_AfterUpdate()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Set db = CurrentDb
strSQL = "SELECT * from [LABOUR TABLE] WHERE [LABOUR NO]=" & Me![labour no]
Set rst = db.OpenRecordset(strSQL)
Me![SALARY] = rst![DAILY SALARY]
rst.Close
End Sub
Klatuu - 30 Nov 2005 14:51 GMT
It is a syntax problem:
If [LABOUR NO] is text field:
strSQL = "SELECT * from [LABOUR TABLE] WHERE [LABOUR NO]= '" & Me![labour
no] & "':"
If it is a numeric field:
strSQL = "SELECT * from [LABOUR TABLE] WHERE [LABOUR NO]= " & Me![labour no]
& ":"
Note: It is not a good practice to use spaces in names. A better name
would be LABOUR_NO
> Hi there,
>
[quoted text clipped - 20 lines]
>
> End Sub
Andy - 30 Nov 2005 15:14 GMT
Hi Klatuu,
It is work now! Thanks so much!!!
> It is a syntax problem:
> If [LABOUR NO] is text field:
[quoted text clipped - 31 lines]
> >
> > End Sub