ms access filter subform based on multiple checkboxes (1 Viewer)

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:43
Joined
May 21, 2018
Messages
8,527
Probably have to post what you have. Was it working as you expected in the last version I posted? #56
 

Kobs

Member
Local time
Today, 17:43
Joined
Apr 2, 2020
Messages
46
Your last database example is working. I just copied all your code but mine is not working. I added a new button though for checkbox report. Attached is my database.
 

Attachments

  • DATABASE_2010.zip
    313 KB · Views: 85

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:43
Joined
May 21, 2018
Messages
8,527
For each of the checkboxes there is a TAG property. Look at that. This allows looping, and ability to simply add more checkboxes without rewriting code.
'01*' ... '05*'
 

Attachments

  • MajP_DATABASE_2010 .zip
    305.2 KB · Views: 109

Kobs

Member
Local time
Today, 17:43
Joined
Apr 2, 2020
Messages
46
MajP,
How to create a logout navigation button?
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:43
Joined
May 21, 2018
Messages
8,527
How to create a logout navigation button?
What is that? Describe what you want to do.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:43
Joined
May 21, 2018
Messages
8,527
I want to add a logout button
Not very helpful
Do you want to quit the application?
Return to the login form?
The Application.Quit method will close the database if that is what you mean.
If you return to the long in form you need to set the tempvars to null since it appears you are using them to store user login information
 

Kobs

Member
Local time
Today, 17:43
Joined
Apr 2, 2020
Messages
46
When i press the logout button I want to just logout and not to close the database. Is that possible?
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:43
Joined
May 21, 2018
Messages
8,527
I do not know how you login works. My guess is something like this.
Code:
Public Sub LogOut()
  Dim frm As Access.Form
  For Each frm In Forms
    DoCmd.Close acForm, frm.Name
  Next frm
  Application.TempVars("tempCurrentUser") = Null
  Application.TempVars("loginCorrect") = False
  DoCmd.OpenForm "frm_login", , , , , acDialog
End Sub
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:43
Joined
May 21, 2018
Messages
8,527
Place code in a standard module like you greeting module. Then you can call it from any button (any or all forms) or other event, by simply.
Private sub SomeButton_Click
logout
end sub
 

Kobs

Member
Local time
Today, 17:43
Joined
Apr 2, 2020
Messages
46
there is an compile error: expected variable or procedure, not module
 

Kobs

Member
Local time
Today, 17:43
Joined
Apr 2, 2020
Messages
46
There is an compile error: expected variable or procedure, not module

Private Sub cmdLogOut_Click()
LogOut
End Sub
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:43
Joined
May 21, 2018
Messages
8,527
There is an compile error: expected variable or procedure, not module

Private Sub cmdLogOut_Click()
LogOut
End Sub
Just to be clear that is not meant to go in a module. That is an example of how you would call the code that is in a standard module.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:43
Joined
May 21, 2018
Messages
8,527
Please post the DB. If it breaks in code, please post screen shot of where it breaks in vbe.
 

Users who are viewing this thread

Top Bottom