[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 282
  • Last Modified:

check yes/no currenddb.execute

i have a form with positions help per emp......
i have an active button that specifies the current position...
i'm trying to get an after update expression on the yes/no "active" button so that only one position only can have a yes. so when you select yes... the other yes turns to no....  
i had help on this: but i still can't get it to work... maybe i'm doing something wrong  .... this is a previous help comment i got:  can anyone shine some light on this
cause i'm obviously doin something wrong
thanks a bunch....

CurrentDB.Execute Update tblPositions SET CurrentPosition = False WHERE CurrentPosition = True and Position ID <> " & me.CurrentPosition & " and EmployeeID = " & Me.EmployeeID
0
jfgk
Asked:
jfgk
  • 3
  • 2
1 Solution
 
Mike EghtebasDatabase and Application DeveloperCommented:
try:

CurrentDB.Execute "Update tblPositions SET CurrentPosition = False WHERE CurrentPosition = True and [Position ID] <> " & me!CurrentPosition & " and EmployeeID =" & Me!EmployeeID

Make sure [Position ID] & CurrentPosition fields are both number/long.  If they are string, use:

CurrentDB.Execute "Update tblPositions SET CurrentPosition = False WHERE CurrentPosition = True and [Position ID] <> '" & me!CurrentPosition & "' and EmployeeID =" & Me!EmployeeID

0
 
jfgkAuthor Commented:
what is "Current position" supposed to be?
is that the yes no box?
0
 
jfgkAuthor Commented:
i'm getting compile error:
expected end of statement
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
jfgkAuthor Commented:
i put the dao3.6 up in the list in there but not i get sub or function not defined at the emp ID
0
 
morpheus30Commented:
Hi jfgk:

It sounds to me like you want to do is this...

Create an OnClick event on the first check box, let's call it chkBox1:

If Me.chkBox1 THEN
  Me.chkBox2 = FALSE
Else
  Me.chkBox2 = TRUE
End If

Create an OnClick event on the second check box, let's call it chkBox2:

If Me.chkBox2 THEN
  Me.chkBox1 = FALSE
Else
  Me.chkBox1 = TRUE
End If

Then run the query as normal...

CurrentDB.Execute "Update tblPositions SET CurrentPosition = " & Me.CurrentPosition & " WHERE EmployeeID = " & Me.EmployeeID
0
 
morpheus30Commented:
By the way, you could have made matters easier on yourself by using an option group instead...
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now