Solved

check yes/no currenddb.execute

Posted on 2003-11-24
6
275 Views
Last Modified: 2012-06-27
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
Comment
Question by:jfgk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 34

Expert Comment

by:Mike Eghtebas
ID: 9809081
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
 

Author Comment

by:jfgk
ID: 9809390
what is "Current position" supposed to be?
is that the yes no box?
0
 

Author Comment

by:jfgk
ID: 9809452
i'm getting compile error:
expected end of statement
0
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

Author Comment

by:jfgk
ID: 9809544
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
 
LVL 5

Expert Comment

by:morpheus30
ID: 9812294
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
 
LVL 5

Accepted Solution

by:
morpheus30 earned 35 total points
ID: 9812304
By the way, you could have made matters easier on yourself by using an option group instead...
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question