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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
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 |