470,602 Members | 1,731 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,602 developers. It's quick & easy.

ComboBox help needed with selecting "ALL"...

Good day all...I have a combo box that selects numbers (ie. 1,2,3, etc.). What I am looking for is the combo box to have an "ALL" selection. Right now this is what I have for my SQL code:

SELECT [Fund Number Query].Funds, [Fund Number Query].Fund FROM [Fund Number Query] UNION Select "*", "(All)" From [Fund Number Query];

This is what my VB code is showing; however the error is in the:
rs.FindFirst "[Funds]=" & Str(Nz(Me![Combo1], 0)
__________________________________________________ _________
Private Sub Combo1_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Funds]=" & Str(Nz(Me![Combo1], 0)

If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Any help would be greatly appreciated. Thank you.
Jun 27 '07 #1
3 1979
bump.................
Jun 28 '07 #2
I ended up figuring out a way to make it work without adding "ALL." For anyone that cares I placed the following into the criteria of the query.

[forms]![Final 12 Month Rolling Turnover Report].[combo1] is null
Jul 3 '07 #3
puppydogbuddy
1,923 Expert 1GB
Good day all...I have a combo box that selects numbers (ie. 1,2,3, etc.). What I am looking for is the combo box to have an "ALL" selection. Right now this is what I have for my SQL code:

SELECT [Fund Number Query].Funds, [Fund Number Query].Fund FROM [Fund Number Query] UNION Select "*", "(All)" From [Fund Number Query];

This is what my VB code is showing; however the error is in the:
rs.FindFirst "[Funds]=" & Str(Nz(Me![Combo1], 0)
__________________________________________________ _________
Private Sub Combo1_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Funds]=" & Str(Nz(Me![Combo1], 0)

If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Any help would be greatly appreciated. Thank you.

I think your problem is the syntax you are using. You are using numeric syntax applied to a string.

Do Either 1 or 2 below:
1. rs.FindFirst "[Funds]= '" & Str(Nz(Me![Combo1], 0) & "'" 'for text syntax
or
2.rs.FindFirst "[Funds]=" & Val(Nz(Me![Combo1], 0) 'for numeric
Jul 3 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Adam Toline | last post: by
3 posts views Thread by Not Me | last post: by
2 posts views Thread by bhdvir | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.