requery subform help needed

G

Guest

What is the correct way to requery a subform based on user input?

I have..........

With Me
.subfrmDataFiltered.Form.RecordSource = sSql & sWhereClause
.subfrmDataFiltered.Form.Requery
DoCmd.Requery "subfrmDataFiltered"
End With

But it returns all records.


G
 
R

Rob Oldfield

You shouldn't a requery at all. Drop a breakpoint in and check what sSql &
sWhereClause is returning.
 
G

Guest

Thank you Rob,

The sSql and sWhereClause are bringing in the correct string. I set up a
textbox to view it. But I still get all records returned. The subform by
itself has a "recordset = select * from data". Even if I remove that, and run
the form, making different selections, all records are returned.

G
 
R

Rob Oldfield

Either your SQL is wrong (try copying and pasting it into the SQL view of a
query to check that) or it's getting reset by something else (add a button
onto the main form that just does msgbox
subfrmDataFiltered.Form.RecordSource to check that)
 
G

Guest

GOT IT! the subform is working!
I've never had such problems.

Now all I have to do is work through the type mismatches, and figure out why
I get an error on some of the text fields that says I have to enclose in
quotes, or the syntax is wrong.

thank you so very much.

G
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top