cannot refresh form

a_lucian

New member
Local time
Today, 08:32
Joined
Mar 20, 2008
Messages
2
hello

I have a tabular form ( form1) bound to a query ( query1 )

In this form i have three combo boxes,criteria for filtering records in 'table1'.
I have a button on form for running a SQL Statement, on click.
As i click the button, the procedure is running, query1 modifies, containing only filtered results.

The problem is that i can't show the records from query1 in my form.

I have to close form, reopen it and then it shows records in query1.

i've tried Forms ("Form1").Refresh, Forms ("Form1").Requery with no results

Can anyone tell me how to refresh my form, pls?

Lucian
 
As i click the button, the procedure is running, query1 modifies, containing only filtered results.

The problem is that i can't show the records from query1 in my form.

I have to close form, reopen it and then it shows records in query1.
If your form is truly bound to a query, use:
Code:
me.requery
That's all you need.
 
I tried to do what you said, ( insert me.requery) , WITH NO RESULTS
My form is bound to query1, i checked record source for my form, in
View/properties.

Any other ideas pls?

Lucian
 
Can you upload your DB Lucian? It's probably something simple that you're just overlooking...
 
I tried to do what you said, ( insert me.requery) , WITH NO RESULTS
My form is bound to query1, i checked record source for my form, in
View/properties.

Any other ideas pls?

Lucian

Are you working in MS Access 2007? I have the same problem.
 
requerying records

OK folks,

Here is a sample that shows you how to requery. FRM uses a query for a recordsource of a subform, FRM2 uses another query with the same SQL statement, but this query serves as the recordsource for the actual FORM (no subform involved).

frmSQLstatement uses just that (a statement) as its recordsource, and not an actual object. You'll see that all three of these act the same way.

The object called frmREFRESH uses the .Refresh method the same way the object called FRM uses the .Requery method. Notice that the Refresh method doesn't do anything (i.e. - it doesn't filter records and display them on the form). Here's why:



***A refresh process displays current data from a source. It does not pull data from a source. "Pulling" data is like "asking" the source for the data that it houses. The requery action can also be thought of as sort of a "loading" event. Events that affect the loading of a form are drastic ones, such as the deletion of a record. Refreshing a form doesn't take this sort of thing into account, because it is not requesting a reload of the file's data. It is just requesting a re-display of the data (and structure!) that was already loaded into the display tool (the FORM). When you delete a record out of a pre-loaded data set in a form, a refresh displays that record, but the fields indicate the deletion (you will see something like #DELETED in the fields). The structure of the data set is still there (from when it was loaded in the form).***



Anyway, you'll probably almost never use Refresh, and probably never use it if you're working by yourself, outside of a networked environment. Take a look at the sample. It give a few different ways you can use Requery to reload a display tool. If this doesn't fix any of the issues here, than the source of the problem probably does't have anything to do with requerying the object. It's probably somewhere else in the database and it's affecting this process, but being overlooked as having an indirect effect on the issue at hand.

Another thing to note here too is that corruption of a database is very common, especially ones with large amounts of calling processes going on. I wouldn't rule something like that out either. Exporting the objects in question to a new file has fixed corruption problems for me in the past...
 
Last edited:
Adam,

I due appreciate your time. It's unbelievable how persistant you have been and it's not your issue.

Thank you.

I actually got my solution by Me.Recordsource = "Query3"

I went into the recordsource of the mainform and changed it from a select statement to Query3.

So when I hit the button on the onclick it is set for Me.Recordsource = "Query3" and it reruns the recordsource.

The me.query did not work for this because one of the query in the underlying statemnt was changed. If everything I have heard the requery requeries the recordsource as it was when it was loaded.

For the lack of a better word the recordsource is "archived". The requery will rerun the last archived select statement. I know it's not archived but it acts like it.
So if you changed one of the queries in that statement outside of the statement it will run the archived statement. By updateing the record source you reload the query.

I sure I did not explain this well and it doesn't make sense but it worked for me.

Again a BIG Thank you.
 
the requery requeries the recordsource as it was when it was loaded
YES.
The requery will rerun the last archived select statement.
YES. The "archive" that you are referring to is the SOURCE.
By updateing the record source you reload the query.
YES.
I sure I did not explain this well and it doesn't make sense but it worked for me.
As long as you got it fixed, who cares. :) Good luck!
 
Adam,

You have been a gem.

Can you offer some advice for me on the original post. I have failed in my second attempt to restructure this form. I'm going to add another post to the filter by form.

I was days away from done now a 2 weeks late and pay withheld.

I owe you big time for all your help.
 

Users who are viewing this thread

Back
Top Bottom