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

Very easy question on "Refresh" 1

Status
Not open for further replies.

murad5

Technical User
Sep 12, 2003
61
US
I'm sure I'm doing something really stupid here. I've created a form with a "Filters" section at the top. Basically there are four combo boxes here which the user can use to filter the data in the main section of the form. There's some VB code to create a SQL string based on the values in these combo boxes and then update the query the form is based on with this string. This works fine (when I check the query it returns the correct records). My problem is, I can't get the form to show the filtered data without closing it and opening it again.I'm using

me.Refresh

to try to do this. Any ideas?
 
Yes, but with no success. I've also tried splitting the filter section out and making the main form into a subform of it, and then refreshing the subform, but with no joy either.
 
Have you tried saving the form then using,

RefreshDatabaseWindow

as a line in your code to refresh what ever is in the active window?

Just a thought but have you saved the changes to your form before refreshing it. Otherwise are you not just looking at the original form which is open?

Another thing could you not write into your code to save, close then open the form?

dyarwood
 
Thanks Dyarwood. I'm now closing and reopening the form and this does seem to be giving me the correct result, so a star to you!

I can't help but feel that there must be a more elegant solution to this though, does anyone have any tips?
 
I would think there would be a nicer way of doing what you want. If I can think of any I will post back. Cheers for the star.

dyarwood
 
In the forms I build (with dynamic queries rather than filters) I use:

Me.Requery - to re-query based on the changed data
Me.Repaint - to update the form with the changed query data

This works for me in most parts of my forms, but I had problems when I tried using filters also, so I just built my "filter" into the query rather than using the filter option, and everything works great.

What I mean is I have combo-boxes on the form, and a query with those combo boxes as criteria. Then in the on-change event of the combo box I do a re-query and re-paint, so far it has done what I wanted it to do.

Good Luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top