|
-
Apr 8th, 2005, 06:05 PM
#1
Thread Starter
Addicted Member
silly problem with rs updating unnecessarily
hey, i have studied this for hours and yet, i cannot solve the problem. What i have is 6 comboboxes. Now, if any of these comboboxes text values is equal to 'Any', i change the text value in then combobox to '%'. This way i can do a sql query such as:
rs.source = "select * from Cars where Car_Colour like '" & combo1.text & "'"
Now this works fine, but i then have to change the comboboxes value back to 'Any'. This then results in the rs being empty and therefore i cant movenext, moveprevious or anything else. Closing the rs before changing them back to 'Any' also clears the rs.
Has anyone got a way to keep the rs as it is when i do the query, yet still b able to change the comboboxes text back to 'Any'. Any help would be GREATLY appreciated as i'm tearing my hair out over this thanks
BIOSTALL
-
Apr 8th, 2005, 06:08 PM
#2
Re: silly problem with rs updating unnecessarily
Sounds like you are using bound controls - which I am not familiar with...
But you should be able to do:
VB Code:
rs.source = "select * from Cars where Car_Colour like '" & IIF(combo1.text="ANY","%",combo1.text) & "'"
-
Apr 8th, 2005, 07:48 PM
#3
Thread Starter
Addicted Member
-
Apr 9th, 2005, 10:42 AM
#4
Lively Member
Re: silly problem with rs updating unnecessarily
Hi,
In your cmdsearch_click() event you have
If cmbMake.Text = "Any" Then
cmbMake.AddItem "%", 0
cmbMake.RemoveItem (1)
cmbMake.ListIndex = 0
'When the code gets to here it jumps to Private Sub cmbMake_Click()
End If
This is where the problem is. Why it's doing it I don't know.
It's not on the first calling but on the second where you are asking for "%" it changes the cmdModel
so when it comes back it's allready "Any"
Hope this helps will try more later
Fishy
-
Apr 9th, 2005, 12:31 PM
#5
Thread Starter
Addicted Member
Re: silly problem with rs updating unnecessarily
Right, when i was changing the values from '%' back to 'Any', what i've done is put this in the cmdSearch_LostFocus() and it works fine Thanks for your help Fishy.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|