Clearing a form part 2

stuart_adair

Registered User.
Local time
Today, 15:54
Joined
Jan 13, 2009
Messages
57
Hello everyone,

I've got a similar posting to the gent that asked about clearing a form.

I want to be able to display a form and allow the users to select Filter by Form to analyise data. I've created a form with the fields I want that uses my main database table as a record source. When I open the form the 1st record in the database is displayed until I select Filter by Form.

When the form opens I want it to be blank and not be populated with the first record.

Any ideas ?
Stu :D
 
i don't think you have a choice. it does this by default. if you don't want to display anything at all, code it on the open event to be DATAENTRY = TRUE. if it's a data entry form, nothing will display. you could also put a blank record in, that would do it too.
 
Thanks Adam.
I've tried creating a blank form but am struggling as a few of my fields are set where they have to contain data.

Where would I add the DATAENTRY=TRUE bit in your reply? In the button properties I can see On-Click [Event Procedure] which takes me to this bit of SQL...

Private Sub Command38_Click()
On Error GoTo Err_Command38_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "GDR"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command38_Click:
Exit Sub
Err_Command38_Click:
MsgBox Err.Description
Resume Exit_Command38_Click

End Sub
 
Just go into the design view of the form and set the DATA ENTRY property to YES. That will start it off as such until you change it with code.

You will need to turn it off just before you set the filter.

Me.DataEntry = False
Me.Filter = xxxxxxxx
Me.FilterOn = True

etc.
 
Just go into the design view of the form and set the DATA ENTRY property to YES. That will start it off as such until you change it with code.

You will need to turn it off just before you set the filter.

Me.DataEntry = False
Me.Filter = xxxxxxxx
Me.FilterOn = True

etc.
this is right.


whatever event you have the filter on, add the above code to that event before anything else.
 
Correct. There are few times in Access when you'll actually need to use code to do something (other than SQL).
 
Thanks gents, I think I'm almost there.
I've set Data Entry property to Yes and now when the form opens its only displaying data in two field, both of which are set to a particular value by default and dont affect the way the form works. As soon as I click the filter by form button the drop down arrows appear next to each field, but this does bring up the details of the last search performed strangly - again this isnt really a hugh problem
Stu
 

Users who are viewing this thread

Back
Top Bottom