Re: Linked List Boxes on Form
- From: el zorro <elzorro@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 24 Apr 2008 15:33:00 -0700
Right now in the mdb version, the row source for the Employee table is a
select query, and it reads the Department from the Form. Are you saying that
for the adp version I should move the statement to VBA code in the
AfterUpdate event of the first box?
"Sylvain Lafontaine" wrote:
The easiest way of doing this would be to simply rebuild the record source.
of your second combox after the first combox is updated (using its OnUpdate
event):
ComboEmployee.RowSource = "Select ... Where Employee.Dept=" & Me.Department
Of course, if Departement is not a number but an alphanumerical, you must
enclose its value between single quote. You don't have to make a requery
after changing the rowsource of the combobox because a requery is already
automatically made by Access when you change the rowsource.
There are other ways of transmitting a parameter to SQL-Server but this one
is the easiest way.
--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)
"el zorro" <elzorro@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:76E8F4EB-874A-4EB2-9148-3DCF0340568A@xxxxxxxxxxxxxxxx
I have 2 linked list boxes on a form. One lists Departments, and the second
shows the corresponding Employees of the selected Department. In the
Acccess
.mdb version, When a department is selected from the first list, the After
Update event runs VBA code that requeries the second list. When the
Employee
list is requeried, it reads the Department selected from the first list
and
uses it as a query parameter, so that the Employee list shows only the
employees in the selected Department: WHERE
(((Employee.Dept)=[Department]))
-
FOr my conversion of the form to the adp version linked to SQL Server, the
two lists are NOT linked because (apparently) the SQL statement for the
Employee list is clueless about what Department is selected on the form.
-
SO I'm thinking that I need to supply the selected Department to the query
(View) the underlies the Employee list via the VBA code that requeries the
list. SOmething that says: After the Department list is updated, requery
the
Employee list using the selected Department as a criteria.
-
Anybody know how I go about that? Thanks!
- Follow-Ups:
- Re: Linked List Boxes on Form
- From: Sylvain Lafontaine
- Re: Linked List Boxes on Form
- References:
- Linked List Boxes on Form
- From: el zorro
- Re: Linked List Boxes on Form
- From: Sylvain Lafontaine
- Linked List Boxes on Form
- Prev by Date: Re: Why is this faster
- Next by Date: Re: Linked List Boxes on Form
- Previous by thread: Re: Linked List Boxes on Form
- Next by thread: Re: Linked List Boxes on Form
- Index(es):
Relevant Pages
|