Hide Completed

G

Guest

I have a button on my form that is called hide completed. When it is clicked,
it used to filter the form and only display the records who's "Completed?"
field did not have a check mark. Now that there are multiple users using my
database, it filters the form by my txtName field and only displays one
user's records, it doesn't filter by the correct field and correct
parameters. Here is my code for my button:

'this applies a filter that only shows which records do not have a completed
check mark

Private Sub HideCompleted_Click()
On Error GoTo Err_HideCompleted_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, , acMenuVer70

Exit_HideCompleted_Click:
Exit Sub

Err_HideCompleted_Click:
MsgBox Err.Description
Resume Exit_HideCompleted_Click

End Sub

What am I missing or what do I have entered wrong?
 
W

Wolfgang Kais

Hello Annemarie.

Annemarie said:
I have a button on my form that is called hide completed. When it is
clicked, it used to filter the form and only display the records who's
"Completed?" field did not have a check mark. Now that there are
multiple users using my database, it filters the form by my txtName
field and only displays one user's records, it doesn't filter by the
correct field and correct parameters. Here is my code for my button:

'this applies a filter that only shows which records do not have a
completed check mark

Private Sub HideCompleted_Click()
On Error GoTo Err_HideCompleted_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, , acMenuVer70

Exit_HideCompleted_Click:
Exit Sub

Err_HideCompleted_Click:
MsgBox Err.Description
Resume Exit_HideCompleted_Click

End Sub

What am I missing or what do I have entered wrong?

The code applies the filter that is saved with the form. You should
check the filter property in the form's design view and correct the
filter clause there. Alternatively, you can set the filter correctly
using code like this (instead of your DoCmd-line):
Me.Filter = "[completed]=no"
Me.FilterOn = True
 
G

Guest

When I did that, I now get an Enter Parameter Value dialog box with
"completed" and a blank text field, an ok button and a cancel button. Here is
my code:

'this applies a filter that only shows which records do not have a completed
check mark

Private Sub HideCompleted_Click()
On Error GoTo Err_HideCompleted_Click


Me.Filter = "[completed]=no"
Me.FilterOn = True

Exit_HideCompleted_Click:
Exit Sub

Err_HideCompleted_Click:
MsgBox Err.Description
Resume Exit_HideCompleted_Click

End Sub



Wolfgang Kais said:
Hello Annemarie.

Annemarie said:
I have a button on my form that is called hide completed. When it is
clicked, it used to filter the form and only display the records who's
"Completed?" field did not have a check mark. Now that there are
multiple users using my database, it filters the form by my txtName
field and only displays one user's records, it doesn't filter by the
correct field and correct parameters. Here is my code for my button:

'this applies a filter that only shows which records do not have a
completed check mark

Private Sub HideCompleted_Click()
On Error GoTo Err_HideCompleted_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, , acMenuVer70

Exit_HideCompleted_Click:
Exit Sub

Err_HideCompleted_Click:
MsgBox Err.Description
Resume Exit_HideCompleted_Click

End Sub

What am I missing or what do I have entered wrong?

The code applies the filter that is saved with the form. You should
check the filter property in the form's design view and correct the
filter clause there. Alternatively, you can set the filter correctly
using code like this (instead of your DoCmd-line):
Me.Filter = "[completed]=no"
Me.FilterOn = True
 
G

Guest

Nevermind, I got that working. Thank you

Annemarie said:
When I did that, I now get an Enter Parameter Value dialog box with
"completed" and a blank text field, an ok button and a cancel button. Here is
my code:

'this applies a filter that only shows which records do not have a completed
check mark

Private Sub HideCompleted_Click()
On Error GoTo Err_HideCompleted_Click


Me.Filter = "[completed]=no"
Me.FilterOn = True

Exit_HideCompleted_Click:
Exit Sub

Err_HideCompleted_Click:
MsgBox Err.Description
Resume Exit_HideCompleted_Click

End Sub



Wolfgang Kais said:
Hello Annemarie.

Annemarie said:
I have a button on my form that is called hide completed. When it is
clicked, it used to filter the form and only display the records who's
"Completed?" field did not have a check mark. Now that there are
multiple users using my database, it filters the form by my txtName
field and only displays one user's records, it doesn't filter by the
correct field and correct parameters. Here is my code for my button:

'this applies a filter that only shows which records do not have a
completed check mark

Private Sub HideCompleted_Click()
On Error GoTo Err_HideCompleted_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, , acMenuVer70

Exit_HideCompleted_Click:
Exit Sub

Err_HideCompleted_Click:
MsgBox Err.Description
Resume Exit_HideCompleted_Click

End Sub

What am I missing or what do I have entered wrong?

The code applies the filter that is saved with the form. You should
check the filter property in the form's design view and correct the
filter clause there. Alternatively, you can set the filter correctly
using code like this (instead of your DoCmd-line):
Me.Filter = "[completed]=no"
Me.FilterOn = True
 

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