Getting a Run-Time Error with this code..
Hey guys, I'm kinda new to the whole programming with VBA on Access..since I'm just finishing up college and all and doing some database manipulation for a summer job, anyway on to the problem..
We're trying to have one of our databases update another database with some information that is contained on both databases. Now, when I do this, I get a Run-Time Error 3061 'Tew Few Paramters: Expected 1' Below is the code that I've been using for this part of the form.
Dim rs As DAO.Recordset
Dim sqlSI As String
Dim Sign As Variant
Dim updateRec As DAO.Recordset
Dim updateSQL As String
Dim qryData As Variant
sqlSI = "SELECT ([SERVICE RECORDS2].[Service Record])FROM [SERVICE RECORDS2]WHERE [SERVICE RECORDS2].[Service Report #]=" & Me.[Service_Report__] & ";"
Set rs = CurrentDb.OpenRecordset(sqlSI) - This is where I get the error.
Set Sign = rs
MsgBox rs.RecordCount
If rs.RecordCount = 0 Then
'Set updateSQL = dbsCurrent.QueryDefs("QRYSErvice")
updateSQL = "INSERT INTO [Service Records2] ( [Service Report #], ServiceDate, EmployeeID, Description, ContactID, ProjectID, [Dash #], [Service Type], [Test Speed], [Test containers], [Fit Test], [Fit Notes], [Tech Signature], [Customer Signature], [Work Requested], [Customer Comments], [Static Speed], [Jog Speed], [Line Speed], [N/A For Speed], [No Containers], [Mould or Test Container], Containers, [Full Production], [N/A For Service], [Checked Loose/Tight Cont], [Out Of Time Cond], [Checked Loose/Tight Cores] )" & _
"SELECT [Service Records].[Service Report #], [Service Records].ServiceDate, [Service Records].EmployeeID, [Service Records].Description, [Service Records].ContactID, [Service Records].ProjectID, [Service Records].[Dash #], [Service Records].[Service Type], [Service Records].[Test Speed], [Service Records].[Test containers], [Service Records].[Fit Test], [Service Records].[Fit Notes], [Service Records].[Tech Signature], [Service Records].[Customer Signature], [Service Records].[Work Requested], [Service Records].[Customer Comments], [Service Records].[Static Speed], [Service Records].[Jog Speed], [Service Records].[Line Speed], [Service Records].[N/A For Speed], [Service Records].[No Containers], [Service Records].[Mould or Test Container], [Service Records].Containers, [Service Records].[Full Production], [Service Records].[N/A For Service], [Service Records].[Checked Loose/Tight Cont], [Service Records].[Out Of Time Cond], [Service Records].[Checked Loose/Tight Cores]" & _
"FROM [Service Records]WHERE ((([Service Records].[Service Report #])=" & Me.[Service_Report__] & "));"
DoCmd.RunSQL updateSQL
'Set updateRec = CurrentDb.OpenRecordset(updateSQL)
Set qryData = updateRec
Else
MsgBox "Record Already Exists. Please Use the f:\commom\databases\megabase"
End If
'Forms![FormName]!SignIn = Sign
Any help would be great! thanks guys
|