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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Rowsources - fill with text from a text box?

Status
Not open for further replies.

GaryRW

Programmer
Mar 8, 2002
67
GB
Any ideas how to do this one?

I have a combo box and I would like the row source to change dependant on what page of a tab control a user is looking at -

so if the user is looking at page 1, the rowsource is taken from the contents of text boxes on page 1, if looking at page 2, the contents of text boxes on that page are used, etc...

Can I construct a query that will return the contents of different text boxes (or different fields from a database since they are bound boxes) dependant on the page value?

I will as ever be amazed if someone can find a way...
 


Gary

you can cheat ....

create a cmbo box for each tabpage and populate accordingly

then as you change tab you hide the inappropriate combos and show the correct one

so you use some thing like below

create a public variable at form level
say public tabstatus as integer
on the gotfocus of the tabpage set the value
1,2,3

on the on current of the form

'set all combos to hide
me.cmbo1.visible = 0
me.cmbo2.visible = 0
me.cmbo3.visible = 0

select case tabstatus
case 1
me.cmbo1.visible = -1

case 2
me.cmbo2.visible = -1

case 3
me.cmbo3.visible = -1

end select

me.repaint


place each combo box on top of each other and there you are?

Otherwise you are amending the rowsource and requerying all the time which is heavy on traffic and resources.

regards

jo

 
I think it is possible to construct a query but another option to consider would be to set the combo boxes row source type to a value list then in the tabs on change


set its row source

select case tabctl
case 0
me!cbo0.rowsource= text0 & ";" & text1 & ";" text2
case 1
me!cbo0.rowsource= text3 & ";" & text4 & ";" text5
case 2
me!cbo0.rowsource= text6 & ";" & text7 & ";" text8
end select



 
cheers Jo and Gol4

Jo: - you're quite sneaky aren't you.

Gol4: - You've guessed the way I'm doing it at the moment, but unfortunately, the contents of text0 etc.. are quite longwinded (comstructing full names from first name, middle names, surname and title, with the resultant NZ()'s etc)

I think I'm looking for a shortcut that isn't there. I seem to be doing a very repetitive task in setting up each rowsource but I don't think there is a way round it.

I take it from your two responses that there is no clever way to have a row source point to a text box without resorting to queries and requerying the control every time you change record?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top