hello
I m trying to find the solution of a problem.
I wrote in a module this function :
-------------------
Function sql_action_ajout(ByVal NameTable As String, _
ByVal Namequery As String, ByVal ConditionWhere As String) As String
Dim SQL As String, SQLIns As String, SQLSel As String, _
SQLFrm As String, SQLWhr As String
SQLIns = "INSERT INTO [" & NameTable & "]"
SQLSel = "SELECT *"
SQLFrm = "FROM [" & Namequery & "]"
If ConditionWhere <> "" Then
SQLWhr = "WHERE " & ConditionWhere
Else
SQLWhr = ""
End If
End function()
--------------------------
In a form I created a click button with a small script related :
Dim dbs as database
Set dbs = currentdb()
dbs.Execute sql_action_ajout(table1, applicants, " " )
What I expected from this small script was to trigger (call) the sql query contained in the function "sql_action_ajout".
What I wanted to do is to put all the records from applicants into table1; nothing occured !
Moreover, a message appeared, saying that "table1", the first parameter, "was not a declared variable".
I thought we had only to fulfill the parameter one after another in order of appearance.
Am I wrong with the syntax ? perheaps I forgot something ?
Did I forget any quotations?
I hope my english is clear enough
Thanks, in advance for the forthcoming helpful ones.
Jean-Pierre
I m trying to find the solution of a problem.
I wrote in a module this function :
-------------------
Function sql_action_ajout(ByVal NameTable As String, _
ByVal Namequery As String, ByVal ConditionWhere As String) As String
Dim SQL As String, SQLIns As String, SQLSel As String, _
SQLFrm As String, SQLWhr As String
SQLIns = "INSERT INTO [" & NameTable & "]"
SQLSel = "SELECT *"
SQLFrm = "FROM [" & Namequery & "]"
If ConditionWhere <> "" Then
SQLWhr = "WHERE " & ConditionWhere
Else
SQLWhr = ""
End If
End function()
--------------------------
In a form I created a click button with a small script related :
Dim dbs as database
Set dbs = currentdb()
dbs.Execute sql_action_ajout(table1, applicants, " " )
What I expected from this small script was to trigger (call) the sql query contained in the function "sql_action_ajout".
What I wanted to do is to put all the records from applicants into table1; nothing occured !
Moreover, a message appeared, saying that "table1", the first parameter, "was not a declared variable".
I thought we had only to fulfill the parameter one after another in order of appearance.
Am I wrong with the syntax ? perheaps I forgot something ?
Did I forget any quotations?
I hope my english is clear enough
Thanks, in advance for the forthcoming helpful ones.
Jean-Pierre