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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh the form with Combo Box

Status
Not open for further replies.

slin

Technical User
Dec 21, 2006
5
US
Hello, I posted the first part of this question in the VBA coding forum and thanks much to FredaH302 for giving me valuable tips (thread705-131554).

However I am having a small problem now where my subforms would show specific records by scrolling the mouse wheel, but when I click on the item in the Combo Box I become editing that field and Access says it would create duplicates (my combo is primary key to the record). Below are my AfterUpdate codes:

Private Sub cboCourseID_AfterUpdate()
On Error GoTo Err_cboCourseID_AfterUpdate
Me.Recordset.Clone.FindFirst "[CourseID] = '" & Me![cboCourseID] & "'"
If Not Me.Recordset.Clone.EOF Then Me.Bookmark = Me.Recordset.Clone.Bookmark

Exit_cboCourseID_AfterUpdate:
Exit Sub
Err_cboCourseID_AfterUpdate:
MsgBox Err.Description
Resume Exit_cboCourseID_AfterUpdate
End Sub

Is there something I should do to make mouse click work? Or am I getting this all wrong?

Thank you for any help.
 
Oh and also, if I want to add a new record in the table which the Combo Box points to, is there a way to refresh the main form without closing it and reopening it?

Thanks.
 
For me, a combo used as a navigation tool should be unbound.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV,

Thanks for the tip. However when I unbound the combo then it doesn't navigate anymore. Do you think I should create another combo for navigation purposes only?

My current user wanted the form to be easy to use--using the combo to navigate AND modify records. I'm very new to Access and am not sure how to accomplish that task.

Thank you for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top