Hi guys,
I have a local Access table (tblResponses) and a MySQL table (tblAndroid) connected to my database via ODBC. I currently use two queries to update data in these tables based on the most recent timestamp (SQL table timestamp being AnswerTIme and local Access timestamp being AnswerTimeLoc). An Android app I am developing updates the SQL table and the Access table pulls updated data from this table. I am learning that I may be able to update both tables using a single query but I do not know how to write this. here are the queries I am using:
To update from local Access table to SQL table:
To update from SQL table to Access table:
So as you can see these are the same, just moving data the opposite direction.
Any insight is appreciated.
Thanks!
I have a local Access table (tblResponses) and a MySQL table (tblAndroid) connected to my database via ODBC. I currently use two queries to update data in these tables based on the most recent timestamp (SQL table timestamp being AnswerTIme and local Access timestamp being AnswerTimeLoc). An Android app I am developing updates the SQL table and the Access table pulls updated data from this table. I am learning that I may be able to update both tables using a single query but I do not know how to write this. here are the queries I am using:
To update from local Access table to SQL table:
Code:
UPDATE tblAndroid
INNER JOIN tblResponses
ON (tblAndroid.QstnID = tblResponses.QstnID)
AND (tblAndroid.RspnsID = tblResponses.RspnsID)
SET tblAndroid.Rspns = [tblResponses].[Rspns], tblAndroid.RspnsComment = [tblResponses].[RspnsComment], tblAndroid.FlagTag = [tblResponses].[RepeatRec], tblAndroid.ImgPath = [tblResponses].[ImgPath], tblAndroid.AnswerTIme = [tblResponses].[AnswerTimeLoc]
WHERE (((tblResponses.RspnsID) Like [forms]![frmSyncAndroid]![txtRspnsID])
AND ((tblResponses.AnswerTimeLoc)>[tblAndroid].[AnswerTIme]));
To update from SQL table to Access table:
Code:
UPDATE tblResponses
INNER JOIN tblAndroid
ON (tblResponses.RspnsID = tblAndroid.RspnsID)
AND (tblResponses.QstnID = tblAndroid.QstnID)
SET tblResponses.Rspns = [tblAndroid].[Rspns], tblResponses.RspnsComment = [tblAndroid].[RspnsComment], tblResponses.RepeatRec = [tblAndroid].[FlagTag], tblResponses.ImgPath = [tblAndroid].[ImgPath], tblResponses.AnswerTimeLoc = [tblAndroid].[AnswerTIme]
WHERE (((tblAndroid.AnswerTIme)>[tblResponses].[AnswerTimeLoc])
AND ((tblResponses.RspnsID) Like [forms]![frmSyncAndroid]![txtRspnsID]));
So as you can see these are the same, just moving data the opposite direction.
Any insight is appreciated.
Thanks!