473,474 Members | 1,348 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Updating the date

3 New Member
I have an Access 2000 db and I am having trouble trying to create the right update sql. Here are the two tables I am interested in

ArchInvoices
------------------
InvoiceID, Long <--- PK
InvoiceNumber, Long
SaleType, char(1)
TransactionDate, DateTime
Discount, Integer
WholesaleFlag, Boolean
PaymentType, Char(6)
CustPONumber, Char(30)
ShortName, Char(30)
MdCountyCode, Char(2)
TaxFreeID, Char(30)
Paid, Boolean
FestInvoiceNumber, long

ArchLineItems
----------------------
TransactionType, Char(1)
Units, Integer
UnitCost, Double
BottleSize, Double
InvoiceNumber, Long <----- Foreign Key from ArchInvoices.InvoiceNumber
LineItemID, Long <----- PK
ProductCode, Char(6)
TransactionDate, DateTime
MdCountyCode, Char(2)
ShortName, Char(30)
WholesaleFlag, Boolean
Discount, Integer
TaxFree, Boolean

Ok, this is a 1 to many relationship, with the ArchInvoices on the 1 side and the ArchLineItems on the many side. The InvoiceNumber in both tables is the key -- foreign key link.

For every Invoice there are many line items.

What I want to do is to update the TransactionDate in the ArchLineItems table with the TransactionDate from the ArchInvoices table. So, far I keep on getting syntax errors from Access.

Here is one of my many attempts at this

UPDATE ArchLineItems SET ArchLineItems.TransactionDate = ArchInvoices.TransactionDate WHERE ArchInvoices.InvoiceNumber = ArchLineItems.InvoiceNumber

Access keeps giving me a missing one parameter error. I need some help here. Thank you

Edgar N. Cohen | [email address removed]
Sep 24 '07 #1
2 2041
Scott Price
1,384 Recognized Expert Top Contributor
Hi Edgar and welcome to the Scripts!

Two thoughts... First is to change the order of your WHERE criteria, ArchLineItems should come first, then ArchInvoices.

Second, does it work if you change the WHERE criteria to point to a control on a form or to a manually entered InvoiceNumber instead of pointing the two tables at each other?

Expand|Select|Wrap|Line Numbers
  1. UPDATE ArchLineItems SET ArchLineItems.TransactionDate = ArchInvoices.TransactionDate WHERE ArchInvoices.InvoiceNumber = ArchLineItems.InvoiceNumber
Regards,
Scott

p.s. I removed your email address for your own safety! The site rules prohibit posting of email addresses for several reasons. MODERATOR
Sep 24 '07 #2
ADezii
8,834 Recognized Expert Expert
I have an Access 2000 db and I am having trouble trying to create the right update sql. Here are the two tables I am interested in

ArchInvoices
------------------
InvoiceID, Long <--- PK
InvoiceNumber, Long
SaleType, char(1)
TransactionDate, DateTime
Discount, Integer
WholesaleFlag, Boolean
PaymentType, Char(6)
CustPONumber, Char(30)
ShortName, Char(30)
MdCountyCode, Char(2)
TaxFreeID, Char(30)
Paid, Boolean
FestInvoiceNumber, long

ArchLineItems
----------------------
TransactionType, Char(1)
Units, Integer
UnitCost, Double
BottleSize, Double
InvoiceNumber, Long <----- Foreign Key from ArchInvoices.InvoiceNumber
LineItemID, Long <----- PK
ProductCode, Char(6)
TransactionDate, DateTime
MdCountyCode, Char(2)
ShortName, Char(30)
WholesaleFlag, Boolean
Discount, Integer
TaxFree, Boolean

Ok, this is a 1 to many relationship, with the ArchInvoices on the 1 side and the ArchLineItems on the many side. The InvoiceNumber in both tables is the key -- foreign key link.

For every Invoice there are many line items.

What I want to do is to update the TransactionDate in the ArchLineItems table with the TransactionDate from the ArchInvoices table. So, far I keep on getting syntax errors from Access.

Here is one of my many attempts at this

UPDATE ArchLineItems SET ArchLineItems.TransactionDate = ArchInvoices.TransactionDate WHERE ArchInvoices.InvoiceNumber = ArchLineItems.InvoiceNumber

Access keeps giving me a missing one parameter error. I need some help here. Thank you

Edgar N. Cohen | [email address removed]
Your UPDATE is probably not working because you need a Unique Index defined for the Referenced Field in the Primary Table. What this means is that the [InvoiceNumber] Field in ArchInvoices must be set to Indexed ==> No Duplicates in order for the SQL Update to work.
.
Sep 25 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Hasanain F. Esmail | last post by:
Hi all, I sincerly thank you all in advance for your help to solve this problem. I have been trying to find a solution to this problem for sometime now but have failed. I am working on a...
5
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated...
14
by: el_sid | last post by:
Our developers have experienced a problem with updating Web References in Visual Studio.NET 2003. Normally, when a web service class (.asmx) is created, updating the Web Reference will...
6
by: recif20002002 | last post by:
Hello I am trying to update table1 and set a new value with a condition selecting only the results for the element with the specified ID and the first one with the Date field null. The query...
3
by: Trez | last post by:
Hey guys, Am new at using ASP.Net. am having some problems updating my SQL DB. whenever i try i get this Error. Can someone help me? Incorrect syntax near 'nvarchar'. Description: An unhandled...
0
by: preeti13 | last post by:
i have a two tables employeenominations and reason if someone storing a data first time it will store into the employeenominations table if name is already exist it will store into the reason table...
9
by: Marianne160 | last post by:
Hi, I know there are various answers to this problem available on the web but none of them seem to work for me. I am using Access 2003 to make a form to look up data from a table. I have so far...
1
by: EyeHawk | last post by:
OK, hopefully somebody can help me out again. My next problem is updating 3 form fields (type list/menu option) that correspond to a date, one for month, one for day and one for year when the user...
11
by: xelA | last post by:
Thanks, it worked. Another problem: Hey folks, where is the bug in this code? When updating the date field, it is updating all the records in the table with the same value (e.g. 2008-01-07) instead...
2
tdw
by: tdw | last post by:
Hi all, I have several ideas on how to do this, but am having difficulty putting the ideas together and figuring out the most efficient way to do this. I have a database of survey coordinate...
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,...
0
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...
0
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...
0
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,...
1
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.