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

filter form on combo box

Status
Not open for further replies.

tcolson

Technical User
Apr 21, 2011
4
US
I'm trying to use an unbound combo box in a switchboard form that will
allow a user to open the main data entry form based upon the values
presented in the combo box.

cboMapMethod reads from SELECT [tlu_Map_Method].[OBJECTID],
[tlu_Map_Method].[Description] FROM tlu_Map_Method;


where the bound column is two columns, column width is set to 0";1",
and tlu_Map_Method.Description is a text field.


The code I am using is:
Private Sub cboMapMethod_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Rare Points"
stLinkCriteria = "[MapMethod]= " & Chr(34) & Me![cboMapMethod] &
Chr(34)
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub


When I manipulate the combo box from the switchboard form, I can
select values but nothing executes on click, the form doesn't open.




 
I'd use the AfterUpdate or the Change event procedure of the combo.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi, changing the even to AfterUpdate or Change results in the same behavior: selecting any one of the text values in the combo list results in "nothing happening", the "Rare Points" form doesn't open. Am I missing another line of code here? Once the text string is selected, the user releases the mouse button, and then what?
 
Private Sub cboMapMethod_AfterUpdate()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Rare Points"
stLinkCriteria = "[MapMethod]= " & Chr(34) & Me![cboMapMethod] & Chr(34)
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub
 
Adding a "breakpoint" or hitting the F8 key IAW the FAQ while in VBA editor did not produce any observable results. With VBA open, and attempting to operate the control, the same behavior results, and no "break" occurs in the code (?)
 
How are ya tcolson . . .

Try setting the [blue]Bound Column[/blue] to one (1). I'm sure you want to ping on [blue]OBJECTID[/blue] and not the [blue]Description[/blue].

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top