Update query statement in VBA codes Error

F

FA

I have a Update query statement in VBA codes and i am getting the
following error.
Run-time error '3061' Too few parameters. Expected 17.

Below is my codes.
Private Sub Command93_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strFlagSQL As String
Set db = CurrentDb
strFlagSQL = "Update dbo_SYS_INFO Set dbo_SYS_INFO.RIT_AT_DATE =
dbo_CSA_AT.ResultDateGMT," & _
" dbo_SYS_INFO.RIT_AT_CTAC_NME = dbo_CSA_AT.YourName," & _
" dbo_SYS_INFO.RIT_AT_CTAC_NO = dbo_CSA_AT.YourPhone," & _
" dbo_SYS_INFO.SYS_EXPD_PROD_DATE = dbo_CSA_AT.qr320," & _
" dbo_SYS_INFO.SYS_DEV_TECH_CTAC_NME = dbo_CSA_AT.DeveloperName," & _
" dbo_SYS_INFO.SYS_DEV_TECH_CTAC_NO = dbo_CSA_AT.DeveloperPhone," &
_
" dbo_SYS_INFO.SYS_DB_NME = dbo_CSA_AT.DatabaseName," & _
" dbo_SYS_INFO.SYS_DB_SERV_NME = dbo_CSA_AT.DatabaseServerName," & _
" dbo_SYS_INFO.SYS_WEB_SERV_NME = dbo_CSA_AT.WebServerName," & _
" dbo_SYS_INFO.SYS_WEB_SERV_URL = dbo_CSA_AT.WebServerURL," & _
" dbo_SYS_INFO.SYS_URL = dbo_CSA_AT.URLtoTest," & _
" dbo_SYS_INFO.SYS_2_CC = dbo_CSA_AT.CharacterApplicationCode," & _
" dbo_SYS_INFO.SYS_DESC = dbo_CSA_AT.qr30y," & _
" dbo_SYS_INFO.SYS_PROJ_DESC = dbo_CSA_AT.qr32y," & _
" dbo_SYS_INFO.RIT_AT_SCORE = dbo_CSA_AT.Total," & _
" dbo_SYS_INFO.SYS_CLASS_INFO_ID = dbo_CSA_AT.SystemClass
Where dbo_SYS_INFO.SYS_ID_CODE = dbo_CSA_AT.ResultID "
db.Execute strFlagSQL, dbFailOnError Or dbSeeChanges
End Sub

Can someone help me out please.

Thanks
 
W

Wayne Morgan

Instead of the WHERE statement linking the two fields together, try a JOIN
statement.

Example:
UPDATE dbo_SYS_INFO INNER JOIN dbo_CSA_AT ON dbo_SYS_INFO.SYS_ID_CODE =
dbo_CSA_AT.ResultID SET .... dbo_SYS_INFO.SYS_CLASS_INFO_ID =
dbo_CSA_AT.SystemClass;

As currently written, dbo_CSA_AT is not listed as a table in the query.
However, it is referred to in each "=" statement. Since the query
interpreter doesn't see the table, it assumes that it is a parameter. You'll
notice that you have 17 "=" statements (including the one in the WHERE
clause), so these are the 17 parameters it is looking for. The statement
above will "declare" the table so that the interpreter will know what it is.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top