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

EOF empties out controls on form

Status
Not open for further replies.

TaylorTot

Technical User
Dec 23, 2003
96
US
Hello,

I am working on an access form when the cmdfilter button is clicked and there are no records matching the results I would like an addition form to open. Unfortunately, because there are no records both forms go blank. Below is my code:

Code:
 Private Sub cmdFilter_Click()
   
   Dim rst As DAO.Recordset
   Dim qdf As QueryDef
   Dim db As Database
      
   Set qdf = CurrentDb.QueryDefs("Get20Mile_SelQry")
   qdf.Parameters(0) = Forms![frmMain]![txtZipCode]
   Set rst = qdf.OpenRecordset(dbOpenDynaset)
   Set Recordset = rst
   If rst.EOF And rst.BOF Then
    DoCmd.OpenForm ("frmError"), acNormal
   
   End If
End Sub

I can get a message box to appear, but again all of the controls are removed from my forms.

Any help would be great!! Thank you!
 
Have you tried to play with the DataEntry property of the form ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thank you for the reply, I'm not sure I understand. I went back to my forms and changed the dataentry property to yes, but I am still having the same problem.
 
What is the value of the AllowAdditions property ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Okay I believe I have figured out the problem, but I don't know how to fix it. Here is my scenario:

My main form has a field called:
txtZipCode

There is a filter button that selects the closest vendors based on the query:
Get20mile_selqry
Displays the results in the subform.

If there are no results then it opens another subform. In this subform the recordset is based on a query called:
GetFirstRecordInQuery_Selqry

The problem: the second query: GetFirstRecordInQuery_Selqry
Is also filtered by the main form text box txtzipcode.

Since the original filter has no records access clears out my details in both my main and subform. Therefore the value to txtzipcode is lost, so the error form comes up blank.

I have NO idea how to fix this. Can you help?

Thank you so much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top