473,748 Members | 6,037 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Update field in one table from field in another

Hello everyone, this is my first post so apologies if i dont get it right
first time, i am a self taught Access user, i am stuck on something i am
trying to do, briefly i have 2 tables, one for vehicle details and one for
inspection details of vehicles in the first table. I have 2 fields that are
the same in both tables, lastsafe and distance, the vehicles table can only
have 1 vehicle to each record, the inspection table can have multiple records
for each vehicle, what i want to do is, when i input the last safe and
distance values in the inspection table i need it to transfer that data to
the vehicles table so that i am not having to type the same information twice
for each record.
Hope that makes sense and any help would be much appreciated.

To make it clearer, here are the fields

vehicles

lastsafe (date field)
Distance (number field

inspections

date (date field)
distance (number field)
Sorry i was wrong earlier, the field names are not the same but the data type
are.

Jun 5 '07 #1
6 5856
I'm assuming that you have a fleet of vehicles for which you have info such
as make, year model, VIN, License #, etc. and you do periodic inspections on
these vehicles that you enter a safety inspection date and an odometer
reading.
I would have my vehicle info in the one file with a unique key field (set it
to autonumber.) Do not include the lastsafe and distance fields. I would
then create the inspection table with a key field set to a Long Integer
number, the same as the key field in the vehicles table, as well as the date
and distance fields.
Create a form based on the vehicle table and place a subform based on the
inspection table in that form and link them by their two key fields.
Anytime a particular vehicle is brought up in the form, any data put in the
subform will always be linked to that one vehicle. You will have a list of
all safety inspection dates and distances and if you jsut need a list of the
last inspection dates for each vehicle you can do this via a query.
Hope this helps. If you need additional information, ask.

KevinPreston wrote:
>Hello everyone, this is my first post so apologies if i dont get it right
first time, i am a self taught Access user, i am stuck on something i am
trying to do, briefly i have 2 tables, one for vehicle details and one for
inspection details of vehicles in the first table. I have 2 fields that are
the same in both tables, lastsafe and distance, the vehicles table can only
have 1 vehicle to each record, the inspection table can have multiple records
for each vehicle, what i want to do is, when i input the last safe and
distance values in the inspection table i need it to transfer that data to
the vehicles table so that i am not having to type the same information twice
for each record.
Hope that makes sense and any help would be much appreciated.

To make it clearer, here are the fields

vehicles

lastsafe (date field)
Distance (number field

inspections

date (date field)
distance (number field)

Sorry i was wrong earlier, the field names are not the same but the data type
are.
--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200706/1

Jun 5 '07 #2
Thanks for your prompt assistance to my query, however it doesn't really help.

The vehicles table has 38 fields in it, the inspections table has 77 fields
in it.
The form associated with the vehicles table already includes a subform list
all inspections on a particular vehicle.
I need to be able to look at a particular vehicle and it show me when the
last inspection was completed and the odometer reading, without me having to
revert to the subform list, also eventually when i figure out how to do it,
it will also work out when the next inspection is due, which is either 6,8,10
or 12 weeks forward.
when i input the data for the inspection table for a particular vehicle it is
always the latest inspection so would be easier to updat the lastsafe field
in the vehicles table, this would then save me having to open the vehicles
form and enter the same info.
Hope this explains more fully why i have the two fields on the vehicles table,
incidently the vehicles table was developed first and the inspection was
added later. at the moment, to keep everything accurate i update the vehicle
lastsafe date and then open the inspections form and fill in the details for
the inspection.

jahoobob wrote:
>I'm assuming that you have a fleet of vehicles for which you have info such
as make, year model, VIN, License #, etc. and you do periodic inspections on
these vehicles that you enter a safety inspection date and an odometer
reading.
I would have my vehicle info in the one file with a unique key field (set it
to autonumber.) Do not include the lastsafe and distance fields. I would
then create the inspection table with a key field set to a Long Integer
number, the same as the key field in the vehicles table, as well as the date
and distance fields.
Create a form based on the vehicle table and place a subform based on the
inspection table in that form and link them by their two key fields.
Anytime a particular vehicle is brought up in the form, any data put in the
subform will always be linked to that one vehicle. You will have a list of
all safety inspection dates and distances and if you jsut need a list of the
last inspection dates for each vehicle you can do this via a query.
Hope this helps. If you need additional information, ask.
>>Hello everyone, this is my first post so apologies if i dont get it right
first time, i am a self taught Access user, i am stuck on something i am
[quoted text clipped - 22 lines]
>>Sorry i was wrong earlier, the field names are not the same but the data type
are.
--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200706/1

Jun 6 '07 #3
Do you have a Primary key in the vehicles table that relates to a foreign key
in the inspections table as I described in my first response? I'm assuming
you do since your description below indicates that.
If you do then you can use this query to find the last inspection of a
vehicle and you won't need to put the additional info in the vehicles table.

SELECT vehicles.vehicl e, Max(inspections .date) AS MaxOfdate
FROM inspections LEFT JOIN vehicles ON inspections.veh icleID = vehicles.
vehicleID
GROUP BY vehicles.vehicl e;

You can add another subform based on this query that will display the last
inpsection date. Just replace vehicle with vehicleID and link it the same
way you linked the inspections subform.
KevinPreston wrote:
>Thanks for your prompt assistance to my query, however it doesn't really help.

The vehicles table has 38 fields in it, the inspections table has 77 fields
in it.
The form associated with the vehicles table already includes a subform list
all inspections on a particular vehicle.
I need to be able to look at a particular vehicle and it show me when the
last inspection was completed and the odometer reading, without me having to
revert to the subform list, also eventually when i figure out how to do it,
it will also work out when the next inspection is due, which is either 6,8,10
or 12 weeks forward.
when i input the data for the inspection table for a particular vehicle it is
always the latest inspection so would be easier to updat the lastsafe field
in the vehicles table, this would then save me having to open the vehicles
form and enter the same info.
Hope this explains more fully why i have the two fields on the vehicles table,
incidently the vehicles table was developed first and the inspection was
added later. at the moment, to keep everything accurate i update the vehicle
lastsafe date and then open the inspections form and fill in the details for
the inspection.
>>I'm assuming that you have a fleet of vehicles for which you have info such
as make, year model, VIN, License #, etc. and you do periodic inspections on
[quoted text clipped - 18 lines]
>>>Sorry i was wrong earlier, the field names are not the same but the data type
are.
--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200706/1

Jun 6 '07 #4
Thank you very much for the assistance, it has taken me all afternoon but i
have managed to get what you said working. It isnt quite what i want but it
works. More assistance please
the same inspections table has the distance in it aswell, how can extract the
distance related to the date? i need to show the last safety date and
distance together.
jahoobob wrote:
>Do you have a Primary key in the vehicles table that relates to a foreign key
in the inspections table as I described in my first response? I'm assuming
you do since your description below indicates that.
If you do then you can use this query to find the last inspection of a
vehicle and you won't need to put the additional info in the vehicles table.

SELECT vehicles.vehicl e, Max(inspections .date) AS MaxOfdate
FROM inspections LEFT JOIN vehicles ON inspections.veh icleID = vehicles.
vehicleID
GROUP BY vehicles.vehicl e;

You can add another subform based on this query that will display the last
inpsection date. Just replace vehicle with vehicleID and link it the same
way you linked the inspections subform.
>>Thanks for your prompt assistance to my query, however it doesn't really help.
[quoted text clipped - 22 lines]
>>>>Sorry i was wrong earlier, the field names are not the same but the data type
are.
--
Message posted via http://www.accessmonster.com

Jun 6 '07 #5
Create 2 text boxes on your main form and do a DLookup or DMax on the
subform table to get the values you want.

BTW 77 fields sounds like a design problem, but I could be wrong.

Regards

On Jun 6, 12:31 pm, "KevinPrest on via AccessMonster.c om" <u34811@uwe>
wrote:
Thank you very much for the assistance, it has taken me all afternoon but i
have managed to get what you said working. It isnt quite what i want but it
works. More assistance please
the same inspections table has the distance in it aswell, how can extract the
distance related to the date? i need to show the last safety date and
distance together.

jahoobob wrote:
Do you have a Primary key in the vehicles table that relates to a foreign key
in the inspections table as I described in my first response? I'm assuming
you do since your description below indicates that.
If you do then you can use this query to find the last inspection of a
vehicle and you won't need to put the additional info in the vehicles table.
SELECT vehicles.vehicl e, Max(inspections .date) AS MaxOfdate
FROM inspections LEFT JOIN vehicles ON inspections.veh icleID = vehicles.
vehicleID
GROUP BY vehicles.vehicl e;
You can add another subform based on this query that will display the last
inpsection date. Just replace vehicle with vehicleID and link it the same
way you linked the inspections subform.
>Thanks for your prompt assistance to my query, however it doesn't really help.
[quoted text clipped - 22 lines]
>>>Sorry i was wrong earlier, the field names are not the same but the data type
are.

--
Message posted viahttp://www.accessmonst er.com- Hide quoted text -

- Show quoted text -

Jun 6 '07 #6
Thanks for your suggestion, i will give it a try, your way sounds much easier,
i just need to fgure out how to do that, i am fairly inexprienced with the
programming part.

The inspection form needs 77 fields because it records all the items that are
inspected during the inspection. EG recording tyre pressures on a 4 axle
wagon requires 12 fields just for that.

I also require assistance on another problem, on the same vehicles form i
store the last service date & distance, the vehicles have inspections every 6
weeks but only have services at different intervals, ie once a year, every 12
weeks, every 20,000kms etc. How can i record this without having to go to
every vehicle and change it manually? The service is mentioned on the
inspection sheet, would it be possible to add a check box to note the service
and create a query to check if the vehicle has had aservice and then DLookup
the date & distance?

Regards

Ed Marzan wrote:
>Create 2 text boxes on your main form and do a DLookup or DMax on the
subform table to get the values you want.

BTW 77 fields sounds like a design problem, but I could be wrong.

Regards

On Jun 6, 12:31 pm, "KevinPrest on via AccessMonster.c om" <u34811@uwe>
wrote:
>Thank you very much for the assistance, it has taken me all afternoon but i
have managed to get what you said working. It isnt quite what i want but it
[quoted text clipped - 28 lines]
>>
- Show quoted text -
--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200706/1

Jun 7 '07 #7

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

Similar topics

5
5932
by: Mike | last post by:
Here is my situation; I have two tables in a MS-SQL DB. One table with dollar amounts and service codes. I have a second table that I want to move some information into from the first table. The catch is I want to move one field as is from the first table to the second, but the rest of the fields in the second table are calculations based on fields in the first table. The first table is called XFILE. It has fields SVCCODE, PRICE,...
9
19607
by: Deja User | last post by:
This is probably very simple but I can't figure out a way to update one table from another table. Here is an example: ------ TABLEA ------ first_name last_name
1
6447
by: jlrolin | last post by:
I'm trying to update a new field in a table from a COUNT(*) of Registration IDs grouped by Course IDs. COUNT: Course_ID 11 1234 12 2323 19 8932 I want to populate a NUM_REG field in another table with the COUNT from this query to the records that have matching Course_IDs. Similar to this situation:
1
1749
by: MLH | last post by:
I have a form used as a subform on frmCreateInvoice. It is displayed in datasheet view in the subform control. It displays a few text fields, a boolean field (shown as a checkbox control) and a numeric field. The subform is fed by a query. When I open the main form, I often click the checkbox control in the records listed in the subform control, changing them from False to True. And in the numeric field, I may change the displayed...
0
3237
by: Access Programming only with macros, no code | last post by:
ERROR MESSAGE: Could not update; currently locked by another session on this machine. BACKGROUND I have the following objects: Table1 - HO (which has about 51,000+ records) Table2 - Contact (which has 68,000+ records)
3
2881
by: webcat | last post by:
Hi I need to UPDATE data into a table mainData which contains many fields - one is CODE and one is DESCRIPTION another table DESCRIP is a lookup - it also contains the same fields, but each is populated. i need to run through all records and UPDATE the DESCRIPTION field in mainData based on matching CODE in mainData with CODE in DESCRIP
2
2239
by: tomash | last post by:
Hi! I ve got two tables in Access 2007. I want to update a field of DataTable from another table, DataSumTable when two of their fields equals. ( the fields : Name and Period) I tried this sql code: UPDATE DataTable
4
2843
by: slavisa | last post by:
Im having trouble with updating my 1 table with the information from another! I have a table with 6 fields. Code(pk), Name, Title, Address, State, city, zip the table is called Info. Now i have a excel file which i imported it in the access db as a table called newinfo
1
5331
by: murtazadoc | last post by:
Hy... am having a query regarding updating a table A records from table b on a button click... have created connection sting and commandtext to exexute d query am tryn ds query bt it seems to throw some syntax error cmd.CommandText = "UPDATE stockno_table SET(product_id,Sold,Rec_No)
0
1543
by: Rod Faulk | last post by:
Hi! I have a problem almost exactly like this one: http://bytes.com/topic/access/answers/870079-updating-pivot-table-page-fields-based-another-page-field Nevermind.
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9372
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...
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...
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
4606
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3313
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 we have to send another system
3
2215
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.