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 » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Why this is not returning to the previous control



 
 
Thread Tools Display Modes
  #1  
Old August 11th, 2004, 03:13 PM
Tru Dixon
external usenet poster
 
Posts: n/a
Default Why this is not returning to the previous control



I am calling this function from the OnExit_Event
=RequiredField([FirstName])
The problem I am having is: When the user selects "Yes"
from the Prompt MSGBox. The cursor is not returned to the
textbox that prompted the message.

Function RequiredField(FieldInfo As Variant) As Variant
'confirms if user wants to leave field blank
Dim Response As Integer
Dim Cancel As Integer

If IsNull(FieldInfo) Then
Response = MsgBox("It is recommended that you
complete this field." & Chr(13) & Chr(10) & _
"Do you wish to do that now?", vbYesNo +
vbExclamation, "Required Field!")
If Response = vbNo Then
Cancel = False
Else
Cancel = True
End If
End If
End Function

  #2  
Old August 11th, 2004, 03:29 PM
external usenet poster
 
Posts: n/a
Default Why this is not returning to the previous control

try setting the focus to the control if the user
selects "yes"
-----Original Message-----


I am calling this function from the OnExit_Event
=RequiredField([FirstName])
The problem I am having is: When the user selects "Yes"
from the Prompt MSGBox. The cursor is not returned to the
textbox that prompted the message.

Function RequiredField(FieldInfo As Variant) As Variant
'confirms if user wants to leave field blank
Dim Response As Integer
Dim Cancel As Integer

If IsNull(FieldInfo) Then
Response = MsgBox("It is recommended that you
complete this field." & Chr(13) & Chr(10) & _
"Do you wish to do that now?", vbYesNo +
vbExclamation, "Required Field!")
If Response = vbNo Then
Cancel = False
Else
Cancel = True
End If
End If
End Function

.

  #3  
Old August 12th, 2004, 05:16 AM
Van T. Dinh
external usenet poster
 
Posts: n/a
Default Why this is not returning to the previous control

You are assuming that the Cancel in your fn RequiredField
() is the same as the Cancel argument in the Sub
Control_Exit Event Procedure. They are different
entities. You Cancel only exists in your function and
does get passed back to the Event Procedure.

Actually, I am not even sure that you use Event Procedure
from what you posted.

HTH
Van T. Dinh
MVP (Access)



-----Original Message-----


I am calling this function from the OnExit_Event
=RequiredField([FirstName])
The problem I am having is: When the user selects "Yes"
from the Prompt MSGBox. The cursor is not returned to the
textbox that prompted the message.

Function RequiredField(FieldInfo As Variant) As Variant
'confirms if user wants to leave field blank
Dim Response As Integer
Dim Cancel As Integer

If IsNull(FieldInfo) Then
Response = MsgBox("It is recommended that you
complete this field." & Chr(13) & Chr(10) & _
"Do you wish to do that now?", vbYesNo +
vbExclamation, "Required Field!")
If Response = vbNo Then
Cancel = False
Else
Cancel = True
End If
End If
End Function

.

  #4  
Old August 12th, 2004, 12:02 PM
Stewart Tanner
external usenet poster
 
Posts: n/a
Default Why this is not returning to the previous control

try using
Else
Cancel = True
field.setfocus
End If

alternately when you call this from the on exitevent,

use cancel = requiredfield(fieldName)

and change your code to be
If Response = vbNo Then
RequiredField= False
Else
RequiredField= True
End If



"Tru Dixon" wrote in message
...


I am calling this function from the OnExit_Event
=RequiredField([FirstName])
The problem I am having is: When the user selects "Yes"
from the Prompt MSGBox. The cursor is not returned to the
textbox that prompted the message.

Function RequiredField(FieldInfo As Variant) As Variant
'confirms if user wants to leave field blank
Dim Response As Integer
Dim Cancel As Integer

If IsNull(FieldInfo) Then
Response = MsgBox("It is recommended that you
complete this field." & Chr(13) & Chr(10) & _
"Do you wish to do that now?", vbYesNo +
vbExclamation, "Required Field!")
If Response = vbNo Then
Cancel = False
Else
Cancel = True
End If
End If
End Function



 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
returning control from a modal form to the calling form Paolo Using Forms 3 July 13th, 2004 10:37 AM
Access Calendar lost General Discussion 2 July 7th, 2004 04:58 AM
Inserting a User Control in PowerPoint Aaron Powerpoint 0 June 22nd, 2004 11:52 PM
Restricting entries in a ComboBox tina General Discussion 5 June 14th, 2004 05:13 PM
Combo Box Control - CONTROL tab missing from FORMAT CONTROL dialogue JE McGimpsey Worksheet Functions 0 March 11th, 2004 06:47 PM


All times are GMT +1. The time now is 06:12 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.