Solved

check yes/no currenddb.execute

Posted on 2003-11-24
6
272 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
  • 3
  • 2
6 Comments
 
LVL 33

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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

930 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now