B
BlueWolvering
Hello,
This is a repost because I thought I received a fix but I did not.
This is still broken.
I have used this code before countless times to find records in a
table/query within in VBA. (Using Access 2003).
Here is the code
Dim MyDb As Database, RS As Recordset, TargetQueryName as String
TargetQueryName = "q_VINRESULTS_find_FuelCard"
Set MyDb = CurrentDb
-->Set RS = MyDb.OpenRecordset(TargetQueryName)
RS.MoveFirst
If IsNull(RS.Fields(0).Value) Then
MsgBox "This fuel card is currently unassigned.", vbCritical,
"Unassigned Fuel Card"
Else
VINnum = RS.Fields(0).Value
DoCmd.OpenForm "f_VinResults"
End If
The arrow indicates the line on which the code fails. here is the error
message.
<<<Run-time error '3061':
Too few parameters. Expected 2.>>>
Here is the SQL for the query.
SELECT t_FuelCardInventory.VIN, t_FuelCardInventory.FuelCardNo,
t_FuelCardInventory.FuelCardProvider
FROM t_FuelCardInventory
WHERE (((t_FuelCardInventory.FuelCardNo)=[Forms]![f_SearchPanel]![FCN1]) AND
((t_FuelCardInventory.FuelCardProvider)=[Forms]![f_SearchPanel]![FCP1]));
The goal of this code is to take Fuel Card No and Fuel Card Provider from
the form, find out which VIN they are assigned to, and then shove that Vin
into VINum on the form.
Thanks
This is a repost because I thought I received a fix but I did not.
This is still broken.
I have used this code before countless times to find records in a
table/query within in VBA. (Using Access 2003).
Here is the code
Dim MyDb As Database, RS As Recordset, TargetQueryName as String
TargetQueryName = "q_VINRESULTS_find_FuelCard"
Set MyDb = CurrentDb
-->Set RS = MyDb.OpenRecordset(TargetQueryName)
RS.MoveFirst
If IsNull(RS.Fields(0).Value) Then
MsgBox "This fuel card is currently unassigned.", vbCritical,
"Unassigned Fuel Card"
Else
VINnum = RS.Fields(0).Value
DoCmd.OpenForm "f_VinResults"
End If
The arrow indicates the line on which the code fails. here is the error
message.
<<<Run-time error '3061':
Too few parameters. Expected 2.>>>
Here is the SQL for the query.
SELECT t_FuelCardInventory.VIN, t_FuelCardInventory.FuelCardNo,
t_FuelCardInventory.FuelCardProvider
FROM t_FuelCardInventory
WHERE (((t_FuelCardInventory.FuelCardNo)=[Forms]![f_SearchPanel]![FCN1]) AND
((t_FuelCardInventory.FuelCardProvider)=[Forms]![f_SearchPanel]![FCP1]));
The goal of this code is to take Fuel Card No and Fuel Card Provider from
the form, find out which VIN they are assigned to, and then shove that Vin
into VINum on the form.
Thanks