PC Review


Reply
Thread Tools Rate Thread

Combo Box Filtering

 
 
rozycki1978@yahoo.com
Guest
Posts: n/a
 
      19th Dec 2006
I am trying to use the value in a combo box to filter a form. However,
I have not been able to find the right syntax to make my code work
properly.

Private Sub Combo60_AfterUpdate()

Dim ComboMeal As String
ComboMeal = Me.Combo60

Me.Filter = "[Field Technician] = ComboMeal"
Me.FilterOn = True

End Sub

How can I properly reference the ComboMeal variable within the
Me.Filter statement? Alternatively I could use the value directly from
Me.Combo60 but I have the same syntax or reference problem within the
confines of the Filter statement.

Help is much appreciated!

 
Reply With Quote
 
 
 
 
cclark
Guest
Posts: n/a
 
      19th Dec 2006
Try placing Field Technician as part of the ComboMeal variable.

ie.

Dim ComboMeal As String
ComboMeal = "[Field Technician] = " & Me.Combo60


Me.Filter = ComboMeal
Me.FilterOn = True

cclark



<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I am trying to use the value in a combo box to filter a form. However,
> I have not been able to find the right syntax to make my code work
> properly.
>
> Private Sub Combo60_AfterUpdate()
>
> Dim ComboMeal As String
> ComboMeal = Me.Combo60
>
> Me.Filter = "[Field Technician] = ComboMeal"
> Me.FilterOn = True
>
> End Sub
>
> How can I properly reference the ComboMeal variable within the
> Me.Filter statement? Alternatively I could use the value directly from
> Me.Combo60 but I have the same syntax or reference problem within the
> confines of the Filter statement.
>
> Help is much appreciated!
>



 
Reply With Quote
 
 
 
 
rozycki1978@yahoo.com
Guest
Posts: n/a
 
      19th Dec 2006
OK. Tried it and it returned all blanks on my forms. [Field
Technician] is a text field taht holds a guy's name. The Combo60 box
is a drop-down that lists each of the available names.


Klatuu wrote:
> Private Sub Combo60_AfterUpdate()
>
> Me.Filter = "[Field Technician] = """ & Me.Combo60 & """"
> Me.FilterOn = True
>
> End Sub
>
> This assumes [Field Technician] is a text field.
>
> "(E-Mail Removed)" wrote:
>
> > I am trying to use the value in a combo box to filter a form. However,
> > I have not been able to find the right syntax to make my code work
> > properly.
> >
> > Private Sub Combo60_AfterUpdate()
> >
> > Dim ComboMeal As String
> > ComboMeal = Me.Combo60
> >
> > Me.Filter = "[Field Technician] = ComboMeal"
> > Me.FilterOn = True
> >
> > End Sub
> >
> > How can I properly reference the ComboMeal variable within the
> > Me.Filter statement? Alternatively I could use the value directly from
> > Me.Combo60 but I have the same syntax or reference problem within the
> > confines of the Filter statement.
> >
> > Help is much appreciated!
> >
> >


 
Reply With Quote
 
rozycki1978@yahoo.com
Guest
Posts: n/a
 
      19th Dec 2006
I attempted this code and it forced me back into the debugger for a
problem with the Me.FilterOn = True statement.

cclark wrote:
> Try placing Field Technician as part of the ComboMeal variable.
>
> ie.
>
> Dim ComboMeal As String
> ComboMeal = "[Field Technician] = " & Me.Combo60
>
>
> Me.Filter = ComboMeal
> Me.FilterOn = True
>
> cclark
>
>
>
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I am trying to use the value in a combo box to filter a form. However,
> > I have not been able to find the right syntax to make my code work
> > properly.
> >
> > Private Sub Combo60_AfterUpdate()
> >
> > Dim ComboMeal As String
> > ComboMeal = Me.Combo60
> >
> > Me.Filter = "[Field Technician] = ComboMeal"
> > Me.FilterOn = True
> >
> > End Sub
> >
> > How can I properly reference the ComboMeal variable within the
> > Me.Filter statement? Alternatively I could use the value directly from
> > Me.Combo60 but I have the same syntax or reference problem within the
> > confines of the Filter statement.
> >
> > Help is much appreciated!
> >


 
Reply With Quote
 
rozycki1978@yahoo.com
Guest
Posts: n/a
 
      19th Dec 2006
In the debug screen it tells me that Me.Combo60 = "25" instead of what
I want which is Me.Combo60 = "Joe Schmoe". 25 is Joe Schmoe's
corresponding ID field number in my 2 column table that provides the
list of field technician names. This solution feels very close except
that I need to get the value out of the second column.

Regards,
cclark wrote:
> Try placing Field Technician as part of the ComboMeal variable.
>
> ie.
>
> Dim ComboMeal As String
> ComboMeal = "[Field Technician] = " & Me.Combo60
>
>
> Me.Filter = ComboMeal
> Me.FilterOn = True
>
> cclark
>
>
>
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I am trying to use the value in a combo box to filter a form. However,
> > I have not been able to find the right syntax to make my code work
> > properly.
> >
> > Private Sub Combo60_AfterUpdate()
> >
> > Dim ComboMeal As String
> > ComboMeal = Me.Combo60
> >
> > Me.Filter = "[Field Technician] = ComboMeal"
> > Me.FilterOn = True
> >
> > End Sub
> >
> > How can I properly reference the ComboMeal variable within the
> > Me.Filter statement? Alternatively I could use the value directly from
> > Me.Combo60 but I have the same syntax or reference problem within the
> > confines of the Filter statement.
> >
> > Help is much appreciated!
> >


 
Reply With Quote
 
rozycki1978@yahoo.com
Guest
Posts: n/a
 
      19th Dec 2006
This solution actually works! I had to go into the combo box
properties and change the bound column to "2" instead of "1" and the
filter works perfectly.

I thank everyone for their help! Outstanding!

Klatuu wrote:
> Private Sub Combo60_AfterUpdate()
>
> Me.Filter = "[Field Technician] = """ & Me.Combo60 & """"
> Me.FilterOn = True
>
> End Sub
>
> This assumes [Field Technician] is a text field.
>
> "(E-Mail Removed)" wrote:
>
> > I am trying to use the value in a combo box to filter a form. However,
> > I have not been able to find the right syntax to make my code work
> > properly.
> >
> > Private Sub Combo60_AfterUpdate()
> >
> > Dim ComboMeal As String
> > ComboMeal = Me.Combo60
> >
> > Me.Filter = "[Field Technician] = ComboMeal"
> > Me.FilterOn = True
> >
> > End Sub
> >
> > How can I properly reference the ComboMeal variable within the
> > Me.Filter statement? Alternatively I could use the value directly from
> > Me.Combo60 but I have the same syntax or reference problem within the
> > confines of the Filter statement.
> >
> > Help is much appreciated!
> >
> >


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combo box contents doesn't change when filtering combo box is chan Joe M. Microsoft Access 2 17th Nov 2009 11:38 PM
Filtering a combo box using a combo box Turner.John.P@gmail.com Microsoft Access Form Coding 2 5th Jun 2007 01:25 PM
Combo box filtering contents of other combo box =?Utf-8?B?UmljaGFyZA==?= Microsoft Access Form Coding 2 9th Dec 2005 05:53 PM
filtering or limiting combo/list box from another combo/list box =?Utf-8?B?am1r?= Microsoft Access Form Coding 20 26th Jan 2005 11:07 PM
filtering combo box entries based on the selection of another combo box JulieD Microsoft Access Forms 1 4th Nov 2003 10:46 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:28 PM.