Hi,
I need help. When I click on 'Run" this error window appears: "error #3061: too few parameters. expected 9"
Here is code:
Option Compare Database
Option Explicit
Sub Import_SDC()
Dim cas
cas = Timer
RunSql "Kme"
RunSql "KonMat"
RunSql "Psku"
RunSql "SkuPar"
RunSql "Skl"
RunSql "Subj"
RunSql "TpUct"
RunSql "Dodl"
RunSql "Dodla"
RunSql "APS_SEGM"
Update_DIS
CurrentDb.Execute "UPDATE SDC_Subj AS a SET a.Subj_APS = subj_aps(a.SUBJ_ID)"
CurrentDb.Execute "UPDATE SDC_Subj AS s SET s.KUKLA = 3 WHERE s.ndis='06'"
DoCmd.Echo True, "Ready"
DoCmd.Hourglass False
MsgBox "Èas : " & Format(Timer - cas, "MM:SS"), vbInformation, "Èas Access"
End Sub
Sub RunSql(sTbl$)
Dim rs As Recordset, i%, m1$, m2$, sSQL As String
CurrentDb.Execute "DELETE FROM SDC_" & sTbl$
Set rs = CurrentDb.OpenRecordset("SDC_" & sTbl)
m1 = ""
m2 = ""
For i = 0 To rs.Fields.Count - 1
m1 = m1 & rs.Fields(i).Name & ", "
m2 = m2 & "a.Pole" & i + 1 & ", "
Next
sSQL = "INSERT INTO SDC_" & sTbl$ & " ( " & Left(m1, Len(m1) - 2) & " ) SELECT " & Left(m2, Len(m2) - 2) & " FROM S_" & sTbl$ & " AS a"
CurrentDb.Execute sSQL
End Sub
Sub Update_DIS()
CurrentDb.Execute "UPDATE SDC_Subj AS a SET a.DIS = 'OT'"
CurrentDb.Execute "UPDATE (SDC_Subj AS a INNER JOIN CRM_Obce AS c ON a.OBEC_KOD = c.OBEC_KOD) INNER JOIN Vkbur AS s ON c.cit_region = s.cit_region SET a.DIS =.[dis];"
' CurrentDb.Execute "UPDATE SDC_Subj AS s INNER JOIN Vkbur AS v ON s.DIS = v.DIS SET s.NDIS = [v].[ndis];"
End Sub
Public Function SUBJ_APS(saps As Variant) As Variant
If saps > 10000000000000# Then saps = saps - 9900000000000#
SUBJ_APS = saps
End Function
Can somebody help me with this.
Thanks a lot in advance
I need help. When I click on 'Run" this error window appears: "error #3061: too few parameters. expected 9"
Here is code:
Option Compare Database
Option Explicit
Sub Import_SDC()
Dim cas
cas = Timer
RunSql "Kme"
RunSql "KonMat"
RunSql "Psku"
RunSql "SkuPar"
RunSql "Skl"
RunSql "Subj"
RunSql "TpUct"
RunSql "Dodl"
RunSql "Dodla"
RunSql "APS_SEGM"
Update_DIS
CurrentDb.Execute "UPDATE SDC_Subj AS a SET a.Subj_APS = subj_aps(a.SUBJ_ID)"
CurrentDb.Execute "UPDATE SDC_Subj AS s SET s.KUKLA = 3 WHERE s.ndis='06'"
DoCmd.Echo True, "Ready"
DoCmd.Hourglass False
MsgBox "Èas : " & Format(Timer - cas, "MM:SS"), vbInformation, "Èas Access"
End Sub
Sub RunSql(sTbl$)
Dim rs As Recordset, i%, m1$, m2$, sSQL As String
CurrentDb.Execute "DELETE FROM SDC_" & sTbl$
Set rs = CurrentDb.OpenRecordset("SDC_" & sTbl)
m1 = ""
m2 = ""
For i = 0 To rs.Fields.Count - 1
m1 = m1 & rs.Fields(i).Name & ", "
m2 = m2 & "a.Pole" & i + 1 & ", "
Next
sSQL = "INSERT INTO SDC_" & sTbl$ & " ( " & Left(m1, Len(m1) - 2) & " ) SELECT " & Left(m2, Len(m2) - 2) & " FROM S_" & sTbl$ & " AS a"
CurrentDb.Execute sSQL
End Sub
Sub Update_DIS()
CurrentDb.Execute "UPDATE SDC_Subj AS a SET a.DIS = 'OT'"
CurrentDb.Execute "UPDATE (SDC_Subj AS a INNER JOIN CRM_Obce AS c ON a.OBEC_KOD = c.OBEC_KOD) INNER JOIN Vkbur AS s ON c.cit_region = s.cit_region SET a.DIS =
' CurrentDb.Execute "UPDATE SDC_Subj AS s INNER JOIN Vkbur AS v ON s.DIS = v.DIS SET s.NDIS = [v].[ndis];"
End Sub
Public Function SUBJ_APS(saps As Variant) As Variant
If saps > 10000000000000# Then saps = saps - 9900000000000#
SUBJ_APS = saps
End Function
Can somebody help me with this.
Thanks a lot in advance