Changing data in differant table than form source

bloody_football

Registered User.
Local time
Tomorrow, 07:56
Joined
Sep 8, 2004
Messages
70
I wish to create a button in a form that changes a data object in a differant table than the one that the form is sourced from.
When someone hires a container I wish to change "Available" to "Hired" in the main table.

I know that to change the data in the table that the form is based on is
Code:
Me.[Container] = "Hired"
but how do I get it to update that data in the table called 'main'?
 
Why would you want to have the same "Available / Hired" in 2 different tables?
I would have thought that the 'main' table, which presumably holds the items description etc should also hold its current status. If you need it anywhere else, you could do it with a query.

Col
 
The "Available/Hired" status is only in the 'main' table; the form I use is from the 'quotes' table and when a quote is turned into a sale then I need the status changed in the main table (to a 'Hired').
Just need to know how to change the info in the 'main' table from my form.
 
Last edited:
Got it, thanks for all the help :)

EDIT - Can I get this line any shorter?
Code:
DoCmd.RunSQL ("UPDATE ContainerData SET ContainerData.Status = 'Hired' WHERE ((ContainerData.ContainerNumber) = [Container1]);")
 
Last edited:
3 Questions

A) Is there a shorter way of doing this line?
Code:
DoCmd.RunSQL ("UPDATE ContainerData SET ContainerData.Status = 'Hired' WHERE ((ContainerData.ContainerNumber) = [Container1]);")

B)Can I combine the 2 following lines into one statement -
Code:
DoCmd.RunSQL ("UPDATE ContainerData SET ContainerData.Status = 'On Hire' WHERE ((ContainerData.ContainerNumber) = [Container1]);")
DoCmd.RunSQL ("UPDATE ContainerData SET ContainerData.Status = 'On Hire' WHERE ((ContainerData.ContainerNumber) = [Container2]);")

C)Can I combine the 2 following lines into one statement
Code:
DoCmd.RunSQL ("UPDATE ContainerData SET ContainerData.Status = 'On Hire' WHERE ((ContainerData.ContainerNumber) = [Container1]);")
DoCmd.RunSQL ("UPDATE ContainerData SET ContainerData.ReleaseDate = DateOfHire WHERE ((ContainerData.ContainerNumber) = [Container1]);")
 

Users who are viewing this thread

Back
Top Bottom