listbox rowsource problem

G

Gavpav

hi, i have a form that is not attached to any data, on it
is a listbox. I need to be able to change the rowsource
property of this listbox when i open the form depending on
a value in a field on another form.

I am not too sure of VB, and have tried to do this using
macro's but to no avail. Any help would be much
appreciated.

Gavin
 
G

Gary Miller

Gavin,

Here is one method that doesn't require VBA if you know that
you can always count on the 'other' form being open and
having the value you need populated.

Put a reference to the control on that form in the criteria
line of a query that you use as the rowsource of the
listbox. If you do this, you can just hard code the
rowsource as the query as the query results will change
depending on the value of the control. You would use a
criteria similar to this but substituting your form and
control names...

Forms!frmYourOtherForm!YourControlName

--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
 
T

TC

VB is Visual Basic - a different development product to Access.

VBA is Visual Basic for Applications - the programming language of Access.

Forget macros. Go VBA. The more you learn it, the more you can do with it.

TC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top