Auto Fill Fields

scouser

Registered User.
Local time
Today, 21:02
Joined
Nov 25, 2003
Messages
767
Hi. I would like to auto fill fields on a form after the user makes a selection from a combo box.

I have a form 'frmComputerAssetIDAllocation' that allows users to enter AssetID's and allocate them to computers. Here users enter the AssetID and then they select the Computer that relates to that AssetID from a combo.

They are then required to enter the Description of the asset / make / model & serial number. This is all then stored in tblAssetID

Now make / model & serial number already exists in tblComputers.

I did it this way as I wanted tblAssetID to hold some information about the related asset.

Not all computers have an assetID in my company, however all computers have a Description / Make / Model etc.......

Is it possible to pull data from tblComputers to auto fill the related fields and then store the information in tblAssetID (I know this breaks a few rules!!).

Any better ways of doing it?

Hope that makes sense!!

Phil.
 
The ComboBox wizard will do this for you when you create the ComboBox.

Col
 
Interesting

Thanks for the quick reply Colin. I have been creating them manually. I will take a look at the wizzard.
Thanks,
Phil.
 
Not Quite

Colin maybe I misunderstand or am just doing it wrong but that did not do as I wanted.

tblAssetID - Fields: AssetID/Description/Make/Model/Serial#

tblAssetID stores data entered via 3 forms:
frmComputerAssetIdEntry
frmHardwareAssetIdEntry
frmSoftwareAssetIdEntry

Back to my original post. The ComputerID combo looks up data from tblComputers. How can I then link this to populate the fields for tblAssetID?

Sorry if I repeat myself!!
Thanks,
Phil.
 

Attachments

  • form.JPG
    form.JPG
    19.2 KB · Views: 140
Look at the attachment this has a c ombo box on it and look at the code on he after update
g
 

Attachments

Thanks

Gary thanks for the reply. I will give that a whirl tomorrow (DB is at work!!)
I will post back.
Phil.
 
Null

Gary you effort worked a treat. Just one question. If the field to be populated has no data access returns an error:

Run Time Error 94
Invalid Use of Null

Here is what I have on the after update:

Make = ComputerId.Column(2)
Model = ComputerId.Column(3)
Serial# = ComputerId.Column(4)

Me.Refresh

Just checked. This field does contain data? If I hover mouse over the line Serial# = ComputerId.Column(4) in the debug window it says: Serial#=0???

Any Ideas?
Thanks,
Phil.
 
Last edited:
Error

I believe I have made an error. I will have a closer look.

My post still stands regards handling NULL however so if you gurus have any ideas!!

Thanks,
Phil.
 
Head Scratching Time

The combo 'ComputerID' is based on a lookup query qryComputerIdLOOKUP.
The lookup query has 4 fields:
ComputerID
ComputerMake
ComputerModel
SerialNumber

If I run the query it runs fine and displays data for all fields.

The AfterUpdate event on the combo ComputerID is:

Private Sub ComputerID_AfterUpdate()
Make = ComputerId.Column(1)
Model = ComputerId.Column(2)
SerialNumber = ComputerId.Column(3)
End Sub

The fields make & Model are populated. However SerialNumber remains blank?
If I change: Model = ComputerId.Column(2) to Model = ComputerId.Column(3) then the serial number IS displayed but in the Model Field?

Am I missing something obvious?
Thanks,
Phil.
 
Solved

I have managed to resolve this phantom issue. I simply copied all the data to a new database..................and it worked?

As with previous versions I will post this DB to the Sample Database forum when complete.

Thanks to everyone who took time to respond.
Phil.
 

Users who are viewing this thread

Back
Top Bottom