473,748 Members | 10,649 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.i d =
tbl_hours_Palm1 .id),
Employee = (Select `Employee` from tbl_hours_new where
tbl_hours_new.i d = tbl_hours_Palm1 .id),
Job = (Select `Job` from tbl_hours_new where tbl_hours_new.i d =
tbl_hours_Palm1 .id),
Hours = (Select `Hours` from tbl_hours_new where tbl_hours_new.i d =
tbl_hours_Palm1 .id),
PalmID = (Select `PalmID` from tbl_hours_new where tbl_hours_new.i d =
tbl_hours_Palm1 .id)
WHERE exists (Select id from tbl_hours_new where tbl_hours_new.i d =
tbl_hours_Palm1 .id);

Nov 13 '05 #1
2 2309
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.i d = > tbl_hours_Palm1 .id) AS DATE_VW INNER JOIN (Select
[Job], [Employee] from tbl_hours_new where > tbl_hours_new.i d =
tbl_hours_Palm1 .id) AS EMPLOYEE_JOB_VW ON
DATE_VW.EMPLOYE E=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*******@SPAMh otmail.com
"It's not IT, it's IS"

"JellyMan" <ca*********@ho tmail.com> wrote in message
news:11******** *************@f 14g2000cwb.goog legroups.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.i d =
tbl_hours_Palm1 .id),
Employee = (Select `Employee` from tbl_hours_new where
tbl_hours_new.i d = tbl_hours_Palm1 .id),
Job = (Select `Job` from tbl_hours_new where tbl_hours_new.i d =
tbl_hours_Palm1 .id),
Hours = (Select `Hours` from tbl_hours_new where tbl_hours_new.i d =
tbl_hours_Palm1 .id),
PalmID = (Select `PalmID` from tbl_hours_new where tbl_hours_new.i d =
tbl_hours_Palm1 .id)
WHERE exists (Select id from tbl_hours_new where tbl_hours_new.i d =
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.E mployee = tbl_hours_Palm1 .Employee, tbl_hours_new.J ob =
tbl_hours_Palm1 .Job, tbl_hours_new.H ours = tbl_hours_Palm1 .Hours,
tbl_hours_new.P almID = tbl_hours_Palm1 .PalmID
WHERE (Select id from tbl_hours_new where tbl_hours_new.i d =
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
4035
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 need to input this in an Access database, where I do a comparison with the Actual cost. The table “TblBudget” in Access is made of 4 fields, namely: (1) CostElement (2) CostCenter (3) Month (4) Amount$. At the moment this method is very cumbersome....
2
1817
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 development environment to Office 2003 Professional. My question is: Where can I find a comprehensive description of the known issues that will affect my ability to do all of the above after I upgrade my own development environment to Office...
0
3939
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. It is almost like it is trying to implement it's own COM interfaces... below is the header, and a link to the dll+code: Zip file with header, example, and DLL:...
8
1432
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 DB that sits on the same machine in which the app is running. First off, this works PERFECTLY on my PC, but not on the PC where it will be running. It needs to open the local database and generate a snapshot of the
8
2747
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 the sequence nos and it should be such that i can access it through the structure .plz help me .
2
2082
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 using data imported from an Excel file and the person entering into Excel only cared about the month and day portion and Excel added the current year to the field value. I want to produce a report that shows upcoming anniversaries using a parameter...
6
7901
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 Access 2002 with Excel 2002. So M$ suggest using older Biff5 format (from Office 2000) instead of Biff8. But Biff5 has a problem too. Numbers from fields with input mask set are pasted in Excel as text, if you copy the record (not one field). On the...
9
3942
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 - I have read every post out there and spent hours trying to figure out the problem with no success whatsoever - I have constrained the problem to one form however, and I think it's hiding somewhere in my code associated with this form, which is...
4
4665
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 couple date fields that I have users input various dates like "Date of Birth" and "Access From Date" and "Access To Date". There are multiple users and they invariably input the dates in different formats (i.e., 9/07/06, 09-07-07, 9/7/2007, etc.) The...
0
1447
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 give example VB code. I need to make this work in Access. I know the following code will require a lot of modification for VBA. My Problem is getting started - I have copied the ocx's to the
0
9541
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9370
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8242
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2782
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.