Hi All,
The following code for repeating values in one of my forms has served me well, but now it throws up the "too few parameters expected 1" error:
MSDN help seems to suggest the SQL syntax are at fault, I've looked and looked (not tha I know what I'm looking at!) but cannot find what has caused this to change. Now I can't open the form without this error which highlights the line:
Any help would be greatly appreciated, because I'm stumped.
Thanks,
Ted.
The following code for repeating values in one of my forms has served me well, but now it throws up the "too few parameters expected 1" error:
Code:
Private Sub Form_Current()
Dim db As DAO.Database, rst As DAO.Recordset, SQL As String
If Me.NewRecord Then
Set db = CurrentDb
SQL = "SELECT TOP 1 [ReceiptID], LocationSuffixID, AccountID,PayingInNo, [Date Paid In] ,[Date] " & _
"FROM Receipts " & _
"ORDER BY [ReceiptID] DESC;"
Set rst = db.OpenRecordset(SQL, dbOpenDynaset)
If Not (rst.BOF Or rst.EOF) Then
Me!LocationSuffixID.DefaultValue = Nz(rst!LocationSuffixID, "")
Me!AccountID.DefaultValue = Nz(rst!AccountID, "")
Me!PayingInNo.DefaultValue = Chr(34) & Nz(rst!PayingInNo, "") & Chr(34)
Me![Date Paid In].DefaultValue = "#" & Format(Nz(rst![Date Paid In], Date), "yyyy-mm-dd") & "#"
Me![Date].DefaultValue = "#" & Format(Nz(rst![Date], Date), "yyyy-mm-dd") & "#"
Else
End If
Set rst = Nothing
Set db = Nothing
End If
End Sub
MSDN help seems to suggest the SQL syntax are at fault, I've looked and looked (not tha I know what I'm looking at!) but cannot find what has caused this to change. Now I can't open the form without this error which highlights the line:
Code:
Set rst = db.OpenRecordset(SQL, dbOpenDynaset)
Any help would be greatly appreciated, because I'm stumped.
Thanks,
Ted.