Marshall
Thanks for reply and persevering with me, i will try and explain more clearly.
When a vehicle/trailer comes in to garage for work i book it in to the
database and print 4 different forms, 1 to my printer and 3 to the workshop
printer, previous to this discussion i was using the following booking form:
Job Number - autonumber field and primary key
Reg Number - text box field
date - date field
company - combo field. data from vehicles table
make - combo field. data from vehicles table
model - data from vehicles table.
job description - text field.
The user (normally me) enters the regnumber for vehicles or fleet number for
trailers, the date is filled in with current date automatically or i can
change it if i wish, i the select the company,make & model from the combo
boxes then lastly i enter the job description. All this is then saved in the
booking table.
The vehicles table has the following fields, along with others that are not
applicable to this discussion.
reg Number - text field, primary key
fleet number - text field
company - combo box - data from customers table
make - combo - data from make table
model - combo - data from model table
When i am booking in i mostly know if a vehicle is already in the database
because i am the only person that updates it so i can go straight to the
vehicles form and enter new details. What i want to do is automate the
booking process so that all the user has to enter is the regnumber/fleet
number and the job description and the other 3 fields are filled in
automatically.
Your suggestion worked perfectly if i was just entering a reg number as the
combo just puts up data from the vehicles.regnumber field, however the
problem is that if we have a trailer come in for work we always use the fleet
number to identify it, for two reasons, one it is easier to see as it is on
the headboard of the trailer and secondly the mechanics tend to be a bit
thick and cant be bothered to find the actual reg number off the chassis. So
what i want really is for the booking.regnumber combo to get its info from
two fields, vehicles.regnumber and vehicles.fleetnumber.
To get this working with your suggestion i had to use a query to get the
relevant info from the vehicles table and this worked fine apart from problem
i have mentioned, would this be better coded rather than using a query?
Hopefully you now understand what i want it to do, to me it looks as though
it should be easy to do what i want but i manage to sort one thing then find
another problem.
The reason i want to automate it is mainly for when i am not here, when
someone else does it i come back to work and have to over what they have done
and correct things like wrong reg, make or model etc.
Thanks for suggestion for 2nd problem, i will give that a go and see what i
can do.
Thanking you again for your assistance, i have learnt alot through this site
and the many helpful people like yourself.
Marshall said:
Sorry for delay in responding, i have been busy and only just found time to
look at it again.
[quoted text clipped - 16 lines]
how can i get the details for the trailer from the fleet number field in the
vehicles table?
You're losing me somewhere between the reg, chassis and
fleet numbers. What does the user enter and what value is
the combo box supposed to have after the user selects
something? What is supposed to show in the combo box's drop
down list?
It sort of sounds like you want the combo box to do one
thing if the user selects/enters one kind of number and do
something else for another kind of number. If that's what
you want, it seems like you are describing two different
combo boxes to me.
2nd Problem. If i make cboRegnumber limit to list, how do i make the vehicles
form open so that the user can enter vehicle details then return to booking
and update the fields in that form.
Put some code in the combo box's NotInList event procedure
to open the other form (in Dialog mode).