Google Answers Logo
View Question
 
Q: Microsoft Access - Recordset data in Listbox ( No Answer,   1 Comment )
Question  
Subject: Microsoft Access - Recordset data in Listbox
Category: Computers > Programming
Asked by: david0287-ga
List Price: $17.00
Posted: 29 Jan 2006 13:42 PST
Expires: 31 Jan 2006 03:10 PST
Question ID: 438996
How do I get ADODB.Recordset data to appear in an Access form ListBox?

I have two tables "staff" and "members"
When a user opens the database they use my "login" form
which, given the correct information, sends staff the my "staff" form.
For the "staff" form to know which user had logged in i have used a
'Global veriable'; "OffsetPos" which is set during the login and can
be successfuly called from the "Staff" form. I need to bring up a list
using a ListBox controle in the "staff" form containing details from
the "members" table but only for members who have their "personal
staff" field set as the current loged-in staff member (the offsetPos
value.)

I can not seem to use the global veriable in an expresion in the query
criteria wizard. So i have succsesfuly used the forms code to open a
recordSet and use its filter function to generate the results i need.
HOW do I get the recordset data to appear in a form ListBox???
Answer  
There is no answer at this time.

Comments  
Subject: Re: Microsoft Access - Recordset data in Listbox
From: stolis-ga on 30 Jan 2006 08:36 PST
 
You can use global variables in a query if you first create a public
function to expose the value.  In a module, create the following:

Public Function GetOffsetPos() as Variant
  GetOffsetPos = OffsetPos
End Function

You may want to change the type "Variant" to match the type of
variable you used when declaring the OffsetPos variable.  You might
have used "String" or "Integer", or if you didn't specify a type then
"Variant" is fine.

When you write the query to populate the listbox, just set the
"criteria" for the field you are looking for to GetOffsetPos().

-Stolis

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy