Thingol
Technical User
- Jan 2, 2002
- 169
Hi All,
I hope this is a simple question:
I have a piece of code that updates a query throught the DoCmd RunSQL command:
Question 1:
When I run the code, I have to confirm (for each of the three loops) that I actually want to update the query "qrySelectionLabels". Can I force an "OK" for this through code?
Question 2:
Can I update the "Gender" fieldname in the query "qrySelectionLabels" to "Salutation"? I tried using the AS instruction, but get syntax errors; I think I'm using it in the wrong way. How can I achieve this?
Thanks a lot in advance for any help!
Best regards,
Martijn Senden
In the Beginning there was nothing, which exploded.
--Terry Pratchett, Lords and Ladies--
I hope this is a simple question:
I have a piece of code that updates a query throught the DoCmd RunSQL command:
Code:
strSQL = ""
For inti = 0 To 2
Set Q = db.QueryDefs("qrySelectionLabelsUpdate")
'Update fields for which Gender equals strGender(inti)
strSQL = "UPDATE qrySelectionLabels SET qrySelectionLabels.Gender = '" & strSalutation(inti) & "' WHERE qrySelectionLabels.Gender = '" & strGender(inti) & "';"
Q.sql = strSQL
DoCmd.RunSQL (Q.sql)
Next inti
'Close Querydef
Q.Close
Question 1:
When I run the code, I have to confirm (for each of the three loops) that I actually want to update the query "qrySelectionLabels". Can I force an "OK" for this through code?
Question 2:
Can I update the "Gender" fieldname in the query "qrySelectionLabels" to "Salutation"? I tried using the AS instruction, but get syntax errors; I think I'm using it in the wrong way. How can I achieve this?
Thanks a lot in advance for any help!
Best regards,
Martijn Senden
In the Beginning there was nothing, which exploded.
--Terry Pratchett, Lords and Ladies--