filter on combo box possible?

T

tpcolson

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.
 
J

John W. Vinson

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.

You need to use the AfterUpdate event of the combo, not its Click event.

What's the datatype of MapMethod in the form's recordsource table? I'm
guessing it's a Number, matching ObjectID. If so, you should have column 1
(the ID) as the bound column, and your stLinkCriteria should be

"[MapMethod] = " & Me!cboMapMethod

without the quotes.

I'd also avoid using blanks in object names; if you insist, consider using

stDocName = "[Rare Points]"
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top