Dao

maravinds

Registered User.
Local time
Yesterday, 18:08
Joined
Apr 26, 2006
Messages
26
hallo everyone,

can anyone say what is wrong with the following code.

Private Sub add_country_and_supplier_Click()
On Error GoTo Err_add_country_and_supplier_Click


Dim RFQ_ID As Integer
Dim countryid As Integer
Dim leader As Integer
Dim supplier As Integer
Dim decision As Integer
Dim curren As Integer
Dim Series As Integer
Dim status As Integer
Dim connectnumber As Integer
Dim RFQ_Name As String


RFQ_ID = Me.RFQ_ID
PTGU = Me.PTGU
leader = Me.leader
Country = Me.Country
supplier = Me.supplier
decision = Me.decision
curren = Me.curren
Series = Me.Series
status = Me.status
RFQ_Name = Me.RFQ_Name



Dim s As String


Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim qdef As DAO.QueryDef

Dim strsql As String

Set db = DBEngine(0)(0)

Set rs = db.OpenRecordset("Select * from [tbl RFQ] where [tbl RFQ].[RFQ_ID] = RFQ_ID and [tbl RFQ].[RFQ Name] = RFQ_Name", Type:=dbOpenDynaset)

...
..
..
..

rs.close


I get the following error "Too Few Parameters. Expected 1".


it will be helpful if anyone can explain me what and why the error is.

wiht regards,
aravind.s
 
This query is the problem
Set rs = db.OpenRecordset("Select * from [tbl RFQ] where [tbl RFQ].[RFQ_ID] = RFQ_ID and [tbl RFQ].[RFQ Name] = RFQ_Name", Type:=dbOpenDynaset)

The variables are not beeing substituted...

Try this instead...
Set rs = db.OpenRecordset("Select * from [tbl RFQ] where [tbl RFQ].[RFQ_ID] = " & RFQ_ID & " and [tbl RFQ].[RFQ Name] = '" & RFQ_Name & "'", Type:=dbOpenDynaset)
 

Users who are viewing this thread

Back
Top Bottom