-
view this codes and tell me what i did wrong. this update statement don't do anything
Code:
datGrouping.RecordSource = "UPDATE [Contacts] SET [Group] = '" & tempstring & "'"
datGrouping.RecordSource = "SELECT * FROM [Contacts] ORDER BY CompanyName"
datGrouping.Refresh
-
Try using the Database.Execute method for 'action' queries.
-
Quote:
Originally posted by xstopx81
view this codes and tell me what i did wrong. this update statement don't do anything
Code:
datGrouping.RecordSource = "UPDATE [Contacts] SET [Group] = '" & tempstring & "'"
datGrouping.RecordSource = "SELECT * FROM [Contacts] ORDER BY CompanyName"
datGrouping.Refresh
Easy. The second setting of datGrouping.RecordSource overwrites the first.
-
thanks for replying guys but your suggestions are not working. I have used execute command and also tried deleting the select statment. Both method does not seem to work
-
Maybe you forgot the WHERE statament in the first line. The statment as it appears will not know what rows to update. If you include a "WHERE [PrimaryKey]='SomeValue'", it could work.
Good Look!
[Edited by Tonatiuh on 08-18-2000 at 02:18 PM]
-
If you leave out the WHERE clause, it updates all of them. Using the Execute method with an Update query worked for me.
Try:
Code:
DB.Execute "UPDATE Contacts SET Group = '" & tempstring & "'"
datGrouping.RecordSource = "SELECT * FROM Contacts ORDER BY CompanyName"
datGrouping.Refresh
-
hey thanks for replying... parksie, in ur coding... what's DB? cant i just make it as datgrouping.database.execute? help
-
I just used DB as a placeholder for the original Database object.
-
thanks parksie ... your coding works!!!