Sabtu, 03 November 2012

Re: [MS_AccessPros] employe list

 

Daniel-

Your code might look something like this (in VBA):

Private Sub Form_Current()

' If current employee is "employed"
If Me.Employed Then
' Filter to show only "employed"
Me.cmbEmployee.RowSource = "SELECT EmpID, EmpLast & ', ' &
EmpFirst " & _
"FROM Employees WHERE Employed = True"
Else
' Show all
Me.cmbEmployee.RowSource = "SELECT EmpID, EmpLast & ', ' &
EmpFirst " & _
"FROM Employees"
End If
End Sub

I'm just guessing at your table and field names and what you actually use
as a Row Source.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: Dan Abc <daniel2478a@yahoo.ca>
Reply-To: <MS_Access_Professionals@yahoogroups.com>
Date: Saturday, November 3, 2012 5:58 PM
To: "MS_Access_Professionals@yahoogroups.com"
<MS_Access_Professionals@yahoogroups.com>
Subject: Re: [MS_AccessPros] employe list

Thanks John,

i think i like option 1 better, sounds like in option 2 that you would
make copies of names in another colomn, but that might be useful when
names/descriptions chance and you want to keep history.

i'm just not sure how to dynamically change the row source or assign SQL
to the row source

can you please point out couple more steps for this

thanks,

d

________________________________
From: John Viescas <JohnV@msn.com>
To: MS_Access_Professionals@yahoogroups.com
Sent: Saturday, November 3, 2012 12:49:40 AM
Subject: Re: [MS_AccessPros] employe list


Daniel-

You have two choices:

1) In the Current event of the form, dynamically change the Row Source of
the combo box to with filter for current employees and without filter for
prior employees. You can assign SQL to the Row Source or use the name of
two different queries.

2) Add the fields making up the display column to the query that's the
Record Source for the form. Overlay a Text Box displaying these fields on
top of the display portion of the combo box, and make sure the Tab Stop
property is set to No. This cannot be done if you have built your form
with a Wizard that has applied a Layout to all your controls - you would
have to remove the Layout first.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: daniel2478a <daniel2478a@yahoo.ca>
Reply-To: <MS_Access_Professionals@yahoogroups.com>
Date: Saturday, November 3, 2012 6:19 AM
To: <MS_Access_Professionals@yahoogroups.com>
Subject: [MS_AccessPros] employe list

Hello,

i have simple database that uses an employee table. on a form i have a
drop down to select an employee name, all works good

i added an employed column with yes/no option for the employee list so
only current employees show up on the drop down

i filter this with a query to make a list of only current employees

once an employee is not employed he/she is removed from the query and drop
down just like wanted, but problem is if i look at old forms it wont
display the old employee, (the index to the lookup table is there)

basically the drop down needs to display data from query, but once
selected the data needs to come from the table

how can i get this to work?

thanks,

d

------------------------------------

Yahoo! Groups Links

[Non-text portions of this message have been removed]

------------------------------------

Yahoo! Groups Links

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar