yes/no box checked yes based on certian user

  • Thread starter jomara via AccessMonster.com
  • Start date
J

jomara via AccessMonster.com

I want to have a hidden yes/no box marked yes on a form when a certian user
creates a record on a form. I am trying to track leads a cold caller makes
and gives to sales people. then i can run a query to display all the
contacts where the box is yes. I
 
K

Ken Snell \(MVP\)

Use the form's AfterInsert event to set the value of the checkbox:

Private Sub Form_AfterInsert()
If Me.CertainUser = "TheCorrectUser" Then _
Me.NameOfCheckboxControl.Value = True
End If
 
J

jomara via AccessMonster.com

Thanks for the quick reply must have done soomething wrong here is my code
Private Sub Form_AfterInsert()
If Me.Rep = "78" Then _
Me.ColdCall.Value = True


End Sub

the End If caused a compile error so i took it out
rep is the field for the user, 78 is the user number, and coldcall is the
yes/no checkbox
 
J

jomara via AccessMonster.com

Sorry i am getting a message that the data could not be saved
Thanks for the quick reply must have done soomething wrong here is my code
Private Sub Form_AfterInsert()
If Me.Rep = "78" Then _
Me.ColdCall.Value = True

End Sub

the End If caused a compile error so i took it out
rep is the field for the user, 78 is the user number, and coldcall is the
yes/no checkbox
Use the form's AfterInsert event to set the value of the checkbox:
[quoted text clipped - 9 lines]
 
K

Ken Snell \(MVP\)

The error message you're getting might be related to any of the fields'
values that are being updated/edited on the form. Is this checkbox code the
only change you've made since the form was working ok?

Try moving the code to the form's BeforeUpdate event instead of the form's
AfterInsert event.
--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/


jomara via AccessMonster.com said:
Sorry i am getting a message that the data could not be saved
Thanks for the quick reply must have done soomething wrong here is my code
Private Sub Form_AfterInsert()
If Me.Rep = "78" Then _
Me.ColdCall.Value = True

End Sub

the End If caused a compile error so i took it out
rep is the field for the user, 78 is the user number, and coldcall is the
yes/no checkbox
Use the form's AfterInsert event to set the value of the checkbox:
[quoted text clipped - 9 lines]
and gives to sales people. then i can run a query to display all the
contacts where the box is yes. I
 
J

jomara via AccessMonster.com

moving it to the before update worked thanks for the help
The error message you're getting might be related to any of the fields'
values that are being updated/edited on the form. Is this checkbox code the
only change you've made since the form was working ok?

Try moving the code to the form's BeforeUpdate event instead of the form's
AfterInsert event.
Sorry i am getting a message that the data could not be saved
[quoted text clipped - 13 lines]
 
J

jomara via AccessMonster.com

do have one more question if i had 2 users i wanted to track would it be 78
or 50 or is there another way to write that
jomara said:
moving it to the before update worked thanks for the help
The error message you're getting might be related to any of the fields'
values that are being updated/edited on the form. Is this checkbox code the
[quoted text clipped - 7 lines]
 
K

Ken Snell \(MVP\)

If Me.Rep = "78" Or Me.Rep = "50" Then _
Me.ColdCall.Value = True

--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/


jomara via AccessMonster.com said:
do have one more question if i had 2 users i wanted to track would it be
78
or 50 or is there another way to write that
jomara said:
moving it to the before update worked thanks for the help
The error message you're getting might be related to any of the fields'
values that are being updated/edited on the form. Is this checkbox code
the
[quoted text clipped - 7 lines]
and gives to sales people. then i can run a query to display all
the
contacts where the box is yes. I
 

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