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

Subform is not clearing!

Status
Not open for further replies.

TaylorTot

Technical User
Dec 23, 2003
96
US
Hi,

I have a reset button on my main form that when clicked should clear the main and subforms. Unfortunately, it is only clearing my main form. The code I have is:

Code:
Private Sub cmdReset_Click()
  'Clear the criteria
  Me!txtZipCode = vbNullString
  Me!cboAssetNumber = vbNullString
  Me!txtAddress1 = vbNullString
  Me!txtCity = vbNullString
  Me!txtState = vbNullString
 
  
  Me![fsubProperties].Form.Refresh
  Me![fsubProperties].Form.Filter = False
  End Sub

The recordset for my subform is derived from the below code:

Code:
Dim db As DAO.Database
     Dim rst As DAO.Recordset
     Dim qdf As QueryDef
    
        
    Set qdf = CurrentDb.QueryDefs("Get20Mile_SelQry")
    qdf.Parameters(0) = Forms![frmMain]![txtZipCode]
    Set rst = qdf.OpenRecordset(dbOpenDynaset)
    Set [fsubProperties].Form.Recordset = rst

Thank you for your help :)
 


Have you tried:

Forms!YourMainForm!YourSubForm.Form.Requery
 
Thank you for your reply, I tried that and it didn't work, but I was able to get it working.
 
Could you post the code that did worked for anyone reading this in the future:
 
Hi Lars, I basically reran the query, but I had time this morning and put your line of code in and it worked perfectly, so thank you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top