Enter data from an unbound control

J

Jim L.

I am working on an accident report DB. I have a Vehicles table with fields
like VehNo (vehicle number), Mk, Mdl, VIN, etc. I also have VehicleA & a
VehicleB tables with fields particular to each accident, such as AVeh
(vehicle number), DamageScale, DamageArea, etc. The VehNo and AVeh fields
are joined, and are both primary keys.
On the form I have DLookup codes in the AfterUpdate property of the AVeh
control, so a user can enter the vehicle number, and the vehicle information
controls (make, model, color, VIN) pop up in their respective unbound
controls, allowing the user a way to insure they entered the vehicle number
correctly. This works great, as long as the vehicle has been previously
entered into the Vehicles table. If it has not been entered, the other
controls remain blank.
Is there a way for a user to enter the vehicle information into these same
unbound visible controls (maybe using IIF statements, hidden bound controls
that would equal the value of the unbound control) so they are entered into
the Vehicles table?
 
M

Mark Andrews

I might do it like this:
- have a combo box for user to choose a vehicle number (it might have
multiple visible columns (such as make, model etc....) it would have
multiple columns (even if they are hidden).

if the user chooses a vehicle number from the combo box the other textbox
controls would be populated by
= Me.ComboVehicleNumber.Column(2) or
= Me.ComboVehicleNumber.Column(3)
So you don't need extra Dlookups

Next to the combobox you could have a button to add a new Vehicle (which
would popup a form to enter a new vehicle number and other info and then
requery the combobox). make sure to open the form as a dialog so the code
halts before the requery.

You can also make it so if the user eneters a new vehicle the new vechicle
just entered is choosen when they close the form.

This would ensure a valid vechicle number is choosen and allow for new
vechicles to be entered "on the fly".

The unbound textbox controls show be locked and a different background so
user knows not to enter info in these places.

HTH,
Mark Andrews
RPT Software
http://www.rptsoftware.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top