Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh a subform in a Tab Control using Combo Box

Status
Not open for further replies.

slin

Technical User
Dec 21, 2006
5
US
Hello, I'm new to the Access programming and am having a small problem.

I have a form with a combo box in the main form and a tab control with 2 tabbed pages, each has a subform on it.

Is there a way to click on the combo box so the contents in the subform in the first tab page would change? I've got the following codes for my combo box:

Private Sub CourseID_AfterUpdate()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[CourseID] = '" & Me![CourseID] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Before when I had both subforms on the main form it worked just fine, but the subforms are quite large so I thought putting them in tabs would allow better visibility. Should I have not used the tab control at all?

Thank you for any help.
 
I noticed that the same name appears for both the combobox and the field: it could be that the form cannot distinguish between the two.

rs.FindFirst "[CourseID] = '" & Me![CourseID] & "'"

Make sure you are referencing the names correctly such as:

rs.FindFirst "[CourseID] = '" & Me![Combo26] & "'"

Where [Combo26] is the name (Other tab) of the combo box.
 
FredaH302,

Thank you for the tip, I renamed the combo box field to cboCourseID and changed it in the code. It seems to be working fine now.

I just realized I probably should have posted this post in the Forms forum, oops...

Anyway thank you for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top