Link Combo Box

Mickster

Registered User.
Local time
Yesterday, 17:12
Joined
Feb 10, 2005
Messages
38
Hi there, I am new to access and this question be a no brainer for you access gurus. What I currently have is a form with one combo box and two radio buttons.

Staff and Status

The staff combo box is a drop down menu of all staff members and is derived from a table called Employees. The two radio buttons represent "Active" and "Inactive".

So if John Smith is selected their current status will be shown on the radio button and the user can change it if they want to.

The problem I am having is linking the radio button to a name in the combo box. Any assistance would be appreciated.

Thanks
 
in tbls Employees , Make sure that you'd added status colunm already !
status will be true or false ( mean "Active" or "Inactive") .

Let see :
Form.RecordSource = "Employees"
and
Combo1.RowSource = "SELECT [Employees].[ID] FROM Employees;

then write this code for Combo1's Event:

Code:
Private Sub combo1_AfterUpdate()
    
    Dim rs As Object

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[ID] = '" & Me![combo1] & "'"
    Me.Bookmark = rs.Bookmark
End Sub

ok now you can do what you want ! :D
 
clerics said:
in tbls Employees , Make sure that you'd added status colunm already !
status will be true or false ( mean "Active" or "Inactive") .

Let see :
Form.RecordSource = "Employees"
and
Combo1.RowSource = "SELECT [Employees].[ID] FROM Employees;

then write this code for Combo1's Event:

Code:
Private Sub combo1_AfterUpdate()
    
    Dim rs As Object

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[ID] = '" & Me![combo1] & "'"
    Me.Bookmark = rs.Bookmark
End Sub

ok now you can do what you want ! :D

What does is stored in the Bookmark variable?
 
all of records in Employees (table) where ID of Staff = ID (be chose by users)
will be stored in Bookmark

Set rs = Me.Recordset.Clone <--- get record from Form's recordsource to rs
rs.FindFirst "[ID] = '" & Me![combo1] & "'" <---if ID(in record) = ID(in Form)
Me.Bookmark = rs.Bookmark <--- Set Form 's recordsource again with this ID

Just try to do it ! you can know how it work ! :D Goodluck friend
 
Hi, Thanks for your help. I have placed your code as you specified. But it still doesnt seem to work. In the rs.FindFirst"[ID] = ...... line of the code shouldnt ID be replaced with the employeeName field since I am displaying the name in the combo box?

Where do I add code in the option group so that the value is passed onto the Status field. I have Acitve set as 1 and Inactive as 2. How will this translate into true or false?

Thanks
 
clerics said:
here is example !

Hey Clerics, I am currently running Access 97. Is there any way that you can convert it.

Thanks for the help:)
 

Users who are viewing this thread

Back
Top Bottom