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

How to pass a value from one form to another

Status
Not open for further replies.

sabavno

Programmer
Jul 25, 2002
381
CA
hi

I have the following problem:
I have a form that has a huge listbox on it. When user chooses the row in that listbox, I want to take a value of the first column of the row and open another form that will also consist of a listbox, whose RowSource property will be based on the value I've taken from the first form

This is the code I tried:

intTransit = List0.ItemData(List0.ItemsSelected(0))

'this is to take a value of the first column
'then I need to open another form

DoCmd.OpenForm "TransitBb"
Form_TransitBb.List0.RowSource = "SELECT RecordID, Transit where ((Transit) = " & intTransit & " ORDER BY BlackBerryRecord.PIN "

Well, this code does not work, ...but I put here to give you the idea of what I want to do.

Please suggest anything regarding this issue

Thanks a lot
 
If this is you actual SQL statement then you are missing from clause in you sql statement

Form_TransitBb.List0.RowSource = "SELECT RecordID, Transit
from tablename
where ((Transit) = " & intTransit & " ORDER BY BlackBerryRecord.PIN "

there maybe other issues as well bu that is just my initial galance hope its that easy!
 
Hi,

You can open the form and use its OPENARGS. lieke

DoCmd.OpenForm "TransitBb",, "", "", ,, Str$(intTransit)

In the form: TransitBb ON OPEN event you can test the value of intTransit that you passed with: Me.OpenArgs

like this:

'The value of intTransit.
msgbox "intTransit = " & Me.OpenArgs

Have a good one!
BK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top