Want no records on subform until I choose from my unbound combo box on main form

ml8889

Registered User.
Local time
Today, 09:09
Joined
Oct 12, 2012
Messages
19
I have an unbound combo box in my main form and I have a subform. Upon opening the main form, the combo box shows no records until a selection is made (which is what I want). However I also want the subform to show no records until an item in my combo box on the main form is selected. Right now when I open my main form, the records in the subform show for one of the options in my main form's combo box. And then when I selected an option in the combo box, my subform shows the correct records associated with my selection. I just dont want any records showing beforehand. Is it possible to prevent this? Remember, my combo box is unbound but shows the records in my one column "Managment" tbl (this tbl lists manager names) and then my subform shows the records associated with the "Manager" selected in the combo box.
 
You can either give the subform a record source of SELECT * FROM Tablename WHERE 1=0, or delete the recordsource entirely. Then in the after update event of the combo set it appropriately.
 
Thanks. If I delete the record source in the subform, I get Name# under each column in the subform. I dont know how to write VB scripts and the afterupdate script for the unbound combo box on the main form is foreign to me. (The tbl / record names I gave in my original post were generic for the purpose of an example.) When I click Event Procedure for the unbound combo box, below is what it shows, but first, some background: My combo box shows Names of individuals with the job title of TCC. When a name is selected, the subform will display that TCC's name in one field and add'l fields of information. (User can also add records if desired.)

Private Sub Combo3_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[TCCs] = '" & Me![Combo3] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

What can I change to make it work so that the subform activates the records associated with the TCC once selected in the combo box? (Also, I'm using Access 2003)
 
Last edited:
Did you try what I first posted?

You can add:

Me.SubformControlName.Form.RecordSource = "SELECT..."

or the name of a table or query.
 

Users who are viewing this thread

Back
Top Bottom