list/combo box problem !?

nebon

Registered User.
Local time
Today, 05:26
Joined
May 14, 2003
Messages
51
hallo there ...
I have a form called booking .
in there there is a combobox with 2 column !
film_ref , Film_Title

and then I have a listbox in the same form
in the rowsource of the listbox I have :

SELECT tblShow.SHOW_DATE, tblShow.SHOW_TIME, * FROM tblShow WHERE (((tblShow.FILM_REF)=me!combo0.column(0)));

it would then complain about the me!combo0.column(0)
why is that ? Am I using it in the wrong way ?
 
You don't need the me!combo0.column(0) notation if you're referring to another control from a control on the same form. (You use that type of notation if you're writing VBA code.) You should use something like this:
SELECT.....WHERE tblShow.FILM_REF=[combo0]

You will run into trouble if the column you want from the combo0 control is not the bound column. I don't know if you can call a column directly from SQL, but I think you can place the value into another field and call that field from your SQL string like this:
SELECT ....WHERE tblShow.FILM_REF=[field with column data]

I'm not sure why you have the rowsource like this:

SELECT tblShow.SHOW_DATE, tblShow.SHOW_TIME, * FROM tblShow WHERE (((tblShow.FILM_REF)=me!combo0.column(0)));

You seem to be selecting two fields and then all the fields (including those two again) from the tblShow table.
 
thanks man ! yea , things stated to work , but still have some problem with another combobox, this combobox required 2 fields to identify an unique record , hmm is it possible somehow to have 2 bound columns ? thnks again ...
 
No, you can't have two bound columns from a single combo box, but could you change the query source slightly so that two separate fields show up as a single column in your combo box. Change the rowsource to something like this:
SELECT tblShow.SHOW_DATE & " " & tblShow.SHOW_TIME AS ShowDateTime FROM tblShow WHERE etc...

You'll then get a single column with the show date and time.
 
thanks alot! everything is almost working !
the only thing remaining is that when a value is assigned to the listbox, the bound column should be stored in a textbox how can I do that ???

I have manage to do it on the afterupdate event, but for some strange reason this would only do it if I clicked on the listbox, I want it to do it without me clicking anywhere... thanks again for all the help !
 
Last edited:
I'm not sure why you want to avoid clicking on the listbox, since you need to click it in order to make a selection. Do you mean that you need to click it more than once?

Using the AfterUpdate event of the listbox is the typical way to tell your form to do something after a listbox choice has been made.
 
its perfectly working now , thanks alot
 

Users who are viewing this thread

Back
Top Bottom