Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box problem

Status
Not open for further replies.

macky

Programmer
May 22, 2001
26
0
0
GB
I have a table, ( tblprocessor) with 5 fields which show details of a piece of equipment, 3 fields show related serial numbers, 1 field shows maufacturer and 1 field shows a software version in it. This table through a query makes up a part of another bigger table which is accessed through a form for data editing only, (tblprocessor is used for new data to be added, by selected people). To make data editing easy when the form is in use the user can open the processor details via a combo box in the 1st field which shows the other 4 fields aswell. The user can select one of the entries and the other 4 fields will automatically have the data entered into them, this is becouse I have used the code:
=[comboname].[column](column No) in the 4 fields, to do this I have removed the data source location from these fields which in turn means that when the data automatically enters into these other 4 fields, it does not enter into the main table making report writing a bit of a problem.

Is there a way to use this process and thus making data editing easy for the users but somehow get the data to fill in the correct fields on the main table.

Thanks for your help, this site is a godsend.
 
Yes

Bind the fiels back to the table instead of being =[comboname].[column](column No)

Then in the combo_AfterUpdate event put the code:-

ShowField1=[comboname].[column](1)
ShowField2=[comboname].[column](2)
ShowField3=[comboname].[column](3)
ShowField4=[comboname].[column](4)


QED

G LS
 


Looking back at it since - you've also got bracketing problems. You need:-

ShowField1 = [comboname].Column(1)
ShowField2 = [comboname].Column(2)
ShowField3 = [comboname].Column(3)
ShowField4 = [comboname].Column(4)


And given that you don't have any space characters in comboname then you can get rid of the [ and ] as well.


G LS
 
Thanks for help, but I have 1 more question.

Does the code that you have supplied mean that all "ShowField1" etc go into the AfterUpdate of the combo box only

or

Does each "ShowField1" etc go into the AfterUpdate field for each field that follow the combo box.
 
ALL the code goes into the combo_AfterUpdate because what you want is :-
When the combo is updated the controls 1-4 ( and hence fields 1-4 ) are populated with the data in the combo columns 1-4 ( Assuming that the combo itself will still display column(0) )


'ope-that-'elps.

G LS
 
Thanks for your prompt reply.

I tried both ways from previous note and its obvious now that you are right.

The problem is that I have put the code in the AfterUpdate property using code and the following appears when I try to run it:

Compile Error
Variable Not Defined

When I open the code page for AfterUpdate:

Private Sub termsoftwareno_AfterUpdate() is in yellow
ShowField1 = this part of your code is highlighted Blue and will not run.

I'm sure that I am making a simple mistake somewhere but if you bear with me I'm sure we will work it out.

Thanks again for your time.
 
I have a combo box which lists the names from another table (company_details). When a name is selected in the combo box, I want the company_details form to open (which it does) BUT at the selected record.

Can anyone help?

many thanks
 
You are replacing ShowFieldX with the actual name of the controls on your form .. . .. aren't you ?


G LS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top