A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Events



 
 
Thread Tools Display Modes
  #1  
Old May 27th, 2004, 09:01 PM
Kenny G
external usenet poster
 
Posts: n/a
Default 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  
Old May 28th, 2004, 10:46 AM
Nikos Yannacopoulos
external usenet poster
 
Posts: n/a
Default 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  
Old May 28th, 2004, 02:56 PM
Kenny G
external usenet poster
 
Posts: n/a
Default 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  
Old May 31st, 2004, 09:59 AM
Nikos Yannacopoulos
external usenet poster
 
Posts: n/a
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:52 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.