copy problem

Timoty

Registered User.
Local time
Today, 16:49
Joined
Jul 29, 2003
Messages
105
There is surely as simple answer to this but sometimes it is the simple things that baffle me.

I need to copy a selection from a combo box onto a subform field.

[Forms]![caseinput]![Infonum]![investigator] = [Forms]![caseinput]![InvestigatorID]

However it pastes the ID # from the combo box instead of the name that corresponds to it.

For example if the autoid # 1 shows up as Brown in the combo box, and I select brown, instead of copying the name brown to the subform field it copys the number one.

How can I alter the formula to copy the text instead of the corresponding number from the combo box?
 
You have to specify which Column.

i.e.

Me.cboMyCombo.Column(1) ' returns second column in combo
 
If you are trying to pull anything other than the bound column data, you need to refer to the Columns. Columns are zero based, so the first column would be 0. If the name appears in the second column of the combo box, then:

[Forms]![caseinput]![Infonum]![investigator] = [Forms]![caseinput]![InvestigatorID].Column(1)

should solve your problem.
 
The text that is display is coming from one of the columns in the combo box. Just reference the correct column.

What's happening now is that your expression:
[Forms]![caseinput]![InvestigatorID]
is really equivalent to:
[Forms]![caseinput]![InvestigatorID].Column(0)

Just reference the column that holds the name data using the correct column index number. The index numbers start from column 1 = 0.
 
This place is amazing

How I ever created my first three databases is beyond me.

This forum deserves high praise!!!!

I used to pick my brain for hours and sometimes days. Even if I new the answer...quite often I would not know how to implement the answer. Like the example above....I knew I had to access the right column...but wasn't sure how to write it out.

Unlike before...now I just come to this forum...post my question....surf the WEB for five minutes....(give my brain a rest) and POOF within minutes I have 2 even 3 responses from you guys.

Thanks a billion. This place has made my life easier and I am able to (and more willing to try) new things.
 
After searching I have a similar problem. I have included 2 picture and an explanation the best I know how.

Any help would be massively appreciated!!!!!!!1 :)
 

Attachments

There was two pictures but no explanation that I could see.
 

Users who are viewing this thread

Back
Top Bottom