If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Events
Below is the code I currently have to either skip a control or go to a control based on the response in the complications control. The problem is even when Me.Complications is none the cursor goes to RiskAssessment. What's wrong with my code?
Thanks in advance for your assistance. Private Sub Complications_Exit(Cancel As Integer) If Me.Complications = "None" Then DoCmd.GoToControl "OrderRenewal" Else DoCmd.GoToControl "RiskAssessment" MsgBox "Has A Risk Assessment Form Been Completed?", vbInformation, "UHS" Cancel = True End If End Sub Kenny G |
#2
|
|||
|
|||
Events
Kenny,
With your code as is, DoCmd.GoToControl will be executed if the value of control Compilations is, literally, the word None. Is this what you mean, or do you mean when the control is blank (no entry Null value)? In the latter case, the If statement should be: If IsNull(Me.Complications) Then If, ineed, you meant the word None literally, then there can be one of two things happening: 1. The value of Compilations is not exactly the same, i.e. "None"; if it is a combo box, make sure the row doesn't have, say, a space at the end, which you don't see, but returns the string "None " instead of "None" 2. There is a macro or code behind the On Enter or On Got Focus event of the OrderRenewal control, that passes focus to RiskAssessment control instantly. HTH, Nikos "Kenny G" wrote in message ... Below is the code I currently have to either skip a control or go to a control based on the response in the complications control. The problem is even when Me.Complications is none the cursor goes to RiskAssessment. What's wrong with my code? Thanks in advance for your assistance. Private Sub Complications_Exit(Cancel As Integer) If Me.Complications = "None" Then DoCmd.GoToControl "OrderRenewal" Else DoCmd.GoToControl "RiskAssessment" MsgBox "Has A Risk Assessment Form Been Completed?", vbInformation, "UHS" Cancel = True End If End Sub Kenny G |
#3
|
|||
|
|||
Events
Nikos,
Thanks for your reply. Yes, one of the options in the box is "None". The box has five options. The table for this box looks like this: tbl Complications ComplicationsID(long integer) Complications (txtbox (FieldSize 25)) 1 None 2 Skin Irritation 3 Skin Breakdown 4 Decreased Sensation 5 Motor Impariment Control Source Complications Row Source Type table/query Row Source SELECT tblComplications.ComplicationsID, tblComplications.Complications FROM tblComplications; Bound Column 1 The only code in OrderRenewal is =PC() Proper Case in the afterupdate event. Please let me know what you think. Thank You, Kenny G |
#4
|
|||
|
|||
Events
Kenny,
We pinned it down now! The way you have setup the combo box, it returns the first column (bound column = 1), which is the ComplicationID (1), whereas you are looking for the matching Complication (None) in your code! You need to change the If condition in your code to: If Me.Complications = 1 Then and everything will be fine. HTH, Nikos "Kenny G" wrote in message ... Nikos, Thanks for your reply. Yes, one of the options in the box is "None". The box has five options. The table for this box looks like this: tbl Complications ComplicationsID(long integer) Complications (txtbox (FieldSize 25)) 1 None 2 Skin Irritation 3 Skin Breakdown 4 Decreased Sensation 5 Motor Impariment Control Source Complications Row Source Type table/query Row Source SELECT tblComplications.ComplicationsID, tblComplications.Complications FROM tblComplications; Bound Column 1 The only code in OrderRenewal is =PC() Proper Case in the afterupdate event. Please let me know what you think. Thank You, Kenny G |
Thread Tools | |
Display Modes | |
|
|