J
Jose Perdigao
The following function works good in DAO
DAO:
Public Function AddRecsPPMs()
Dim DB As DAO.Database, strSQL As String, RS As DAO.Recordset
Set DB = DBEngine(0)(0)
strSQL = "INSERT INTO dtPPMs ( [Date], NameID ) SELECT inputDate() AS
[Date], axPPMs.NameID FROM axPPMs WHERE axPPMs.PlatformID=inputPlatform() ;"
DB.Execute strSQL ', dbFailOnError
DB.Close
End If
If a repeat this function doesn’t show the message (were not successful
because they would create duplicates values…), because ', dbFailOnError is
not enable.
Note: InputDate() and inputPlatform() are my ownerfunctions.
ADO:
Dim cnn As ADODB.Connection, RS As ADODB.Recordset, strSQL As String
Set cnn = CurrentProject.Connection
strSQL = "INSERT INTO dtPPMs ( [Date], NameID ) SELECT inputDate() AS
[Date], axPPMs.NameID FROM axPPMs WHERE axPPMs.PlatformID=inputPlatform() ;"
cnn.Execute strSQL
cnn.Close
End Function
If I call this function and if the records are not added it works fine, but
if call second time, shows the message: … were not successful because they
would create duplicates values…,
Question 1.
which attribute must I add after (cnn.execute strSQL,.....) to ignore the
msg above? I mean, if there are not records, add news set records; if there
are not, doesn’t do nothing like the example in DAO.
Question 2
Do you think, the code in DAO and ADO above, is the best for the best
performance? (action queries)
Question 3
Is it possible to add and/or delete records in SQL Server vs ADP by this
method, I mean by action queries?
Question 4
Is it possible to use my owner functions in SQL Server vs ADP?
Thanks a lot for you help or suggestions
Thanks
José
DAO:
Public Function AddRecsPPMs()
Dim DB As DAO.Database, strSQL As String, RS As DAO.Recordset
Set DB = DBEngine(0)(0)
strSQL = "INSERT INTO dtPPMs ( [Date], NameID ) SELECT inputDate() AS
[Date], axPPMs.NameID FROM axPPMs WHERE axPPMs.PlatformID=inputPlatform() ;"
DB.Execute strSQL ', dbFailOnError
DB.Close
End If
If a repeat this function doesn’t show the message (were not successful
because they would create duplicates values…), because ', dbFailOnError is
not enable.
Note: InputDate() and inputPlatform() are my ownerfunctions.
ADO:
Dim cnn As ADODB.Connection, RS As ADODB.Recordset, strSQL As String
Set cnn = CurrentProject.Connection
strSQL = "INSERT INTO dtPPMs ( [Date], NameID ) SELECT inputDate() AS
[Date], axPPMs.NameID FROM axPPMs WHERE axPPMs.PlatformID=inputPlatform() ;"
cnn.Execute strSQL
cnn.Close
End Function
If I call this function and if the records are not added it works fine, but
if call second time, shows the message: … were not successful because they
would create duplicates values…,
Question 1.
which attribute must I add after (cnn.execute strSQL,.....) to ignore the
msg above? I mean, if there are not records, add news set records; if there
are not, doesn’t do nothing like the example in DAO.
Question 2
Do you think, the code in DAO and ADO above, is the best for the best
performance? (action queries)
Question 3
Is it possible to add and/or delete records in SQL Server vs ADP by this
method, I mean by action queries?
Question 4
Is it possible to use my owner functions in SQL Server vs ADP?
Thanks a lot for you help or suggestions
Thanks
José