473,387 Members | 1,517 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Need help with Access SQL format

I have two tables in my Access database that I want to be able to
synchronize by pressing a form button. I think it can work, but I am
not sure how. I am trying to use a single query to do this.

The first table, and more updated table, is called tbl_hours_new. This
table is a linked table to an ODBC conduit to a MySQL database on the
web. (I have full access to this database).

The second table is called tbl_hours_Palm1. This table has all the same
fields and primary keys etc.

What I want to be able to do is get a query to read each record on the
first table, using id as the key, and do an update or replace on the
second table for each record whose id matches. (There is method to my
madness here. I am trying to use another application for my Palm that
won't sync to ODBC or SQL databases so I have to sync to Access and
then write a script to dump it to the live database.)

I have written a SQL statement, but I have done something wrong. I
can't figure out what it is. Access's method of SQL is a bit different
from the MySQL syntax with which I am familiar. The SQL statement is
below.

UPDATE tbl_hours_new SET
[Date] = (Select `Date` from tbl_hours_new where tbl_hours_new.id =
tbl_hours_Palm1.id),
Employee = (Select `Employee` from tbl_hours_new where
tbl_hours_new.id = tbl_hours_Palm1.id),
Job = (Select `Job` from tbl_hours_new where tbl_hours_new.id =
tbl_hours_Palm1.id),
Hours = (Select `Hours` from tbl_hours_new where tbl_hours_new.id =
tbl_hours_Palm1.id),
PalmID = (Select `PalmID` from tbl_hours_new where tbl_hours_new.id =
tbl_hours_Palm1.id)
WHERE exists (Select id from tbl_hours_new where tbl_hours_new.id =
tbl_hours_Palm1.id);

Nov 13 '05 #1
2 2287
JellyMan,
Either through OLE-DB or ODBC or some such I'd try running a pass-through
query so the SQL is executed against MySQL and doesn't have to go through
Jet on its way to MySQL. Jet wants an editable SELECT statement before it
will allow updates to the source tables. Also, entities are bracketed in
Jet, not quoted, so [Date] instead of 'Date'. Jet does allow subqueries, so
an alternative might be:

UPDATE TBL_HOURS_NEW SET . . . (SELECT DATE, HOURS, EMPLOYEE, JOB, PALMID
FROM (Select [Date], [Hours], [PalmID] from tbl_hours_new where
tbl_hours_new.id = > tbl_hours_Palm1.id) AS DATE_VW INNER JOIN (Select
[Job], [Employee] from tbl_hours_new where > tbl_hours_new.id =
tbl_hours_Palm1.id) AS EMPLOYEE_JOB_VW ON
DATE_VW.EMPLOYEE=EMPLOYEE_JOB_VW.EMPLOYEE AND DATE_VW.JOB =
EMPLOYEE_JOB_VW.JOB) AS UPDATES_VW

or something like this. A select statement per value may not work.
--
Alan Webb
kn*******@SPAMhotmail.com
"It's not IT, it's IS"

"JellyMan" <ca*********@hotmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...

I have written a SQL statement, but I have done something wrong. I
can't figure out what it is. Access's method of SQL is a bit different
from the MySQL syntax with which I am familiar. The SQL statement is
below.

UPDATE tbl_hours_new SET
[Date] = (Select `Date` from tbl_hours_new where tbl_hours_new.id =
tbl_hours_Palm1.id),
Employee = (Select `Employee` from tbl_hours_new where
tbl_hours_new.id = tbl_hours_Palm1.id),
Job = (Select `Job` from tbl_hours_new where tbl_hours_new.id =
tbl_hours_Palm1.id),
Hours = (Select `Hours` from tbl_hours_new where tbl_hours_new.id =
tbl_hours_Palm1.id),
PalmID = (Select `PalmID` from tbl_hours_new where tbl_hours_new.id =
tbl_hours_Palm1.id)
WHERE exists (Select id from tbl_hours_new where tbl_hours_new.id =
tbl_hours_Palm1.id);

Nov 13 '05 #2
Thank you for your help Alan. I have attempted to convert the file to a
Pass-Through query and the SQL is the following:

UPDATE tbl_hours_new SET tbl_hours_new.`Date` = tbl_hours_Palm1.`Date`,
tbl_hours_new.Employee = tbl_hours_Palm1.Employee, tbl_hours_new.Job =
tbl_hours_Palm1.Job, tbl_hours_new.Hours = tbl_hours_Palm1.Hours,
tbl_hours_new.PalmID = tbl_hours_Palm1.PalmID
WHERE (Select id from tbl_hours_new where tbl_hours_new.id =
tbl_hours_Palm1.id)<>False;

Now, when I attempt to run the query, it prompts me for a File DSN ODBC
connection. I have a Machine DSN set up, which is how the table is
connected and linked into the access db. I attempted to choose the same
DSN in Machine DSN and I get an "ODBC -- call failed" error. I am at a
loss. I am a newbie to Access, at least this deep in the programming of
a db anyway, and am not even sure how to begin putting in an OLE DB.

Any help would be very much appreciated.

Andrew

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Edward S | last post by:
I budget for a Project in an Excel sheet as illustrated below. The months below are usually a 2 year period i.e. 24 months, though it could be over 24 months depending upon a Project. I then...
2
by: Lauren Wilson | last post by:
Hi Folks, I have a widely distributed Access 200 Application. I must retain my ability to support users who are still on Access 2000 and Access 2000 Runtime. However I also need to upgrade my...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
8
by: D P | last post by:
Hello everyone, I am new here and I hope I can get the help I need. I will be as descriptive as possible!! I have developed an app using VB.NET that requires making a connection to an access...
8
by: skumar434 | last post by:
i need to store the data from a data base in to structure .............the problem is like this ....suppose there is a data base which stores the sequence no and item type etc ...but i need only...
2
by: Bill | last post by:
I have a 200 record database that includes a date/time field, AnnivDate, for a wedding anniversary. AnnivDate has nulls and some incorrect year data. I have been creating the Access database...
6
dima69
by: dima69 | last post by:
Biff format is defined as default format for copying data from Access to Excel (under registry key ...\Access\Clipboard Formats). This format has a known problem as numbers are pasted as text using...
9
by: pic078 via AccessMonster.com | last post by:
I need serious help - I have a frontend/backend Access database (2 MDE Files) that remains stuck in task manager after exiting the application - you can't reopen database after exiting as a result...
4
xstatic
by: xstatic | last post by:
After searching through the hundreds of links about "Javascript Date Formatting", all I am finding is how to format dates that gives a "current date" result. Here is what I need... I have a...
0
by: Dale | last post by:
Access 2000 I have a check scanner from Magtek, (MicrImage) This is like a "point of sale" check scanner/credit card reader. Magtek furnished 2 ocx's (MTMicrImage.ocx & SaxComm8.ocx). They also...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.