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
|
|||
|
|||
Set Focus
I have a main form "fGeneralInfo" with subform "fWorkLog" and subform
"fWorkLogComments". When user enters comments to subform fWorkLogComments and they don't enter their name and date in fWorkLog.CboTech and fWorkLog.StartTime, I want a msg to pop up telling them to do so and to set the focus to CboTech and then StartTime if both are not filled in. I have the following code on BeforeUpdate of the subform "fWorkLogComments". I have entered may combinations of SetFocus and can get nothing to work. The message will pop up, but if user clicks ok at each one, they will eventually leave the form. I really need to have Tech and StartTimes required for these entries. I would very much appreciate any help with this. Pam Private Sub Form_BeforeUpdate(Cancel As Integer) If IsNull(Me.Parent.fWorkLog!Tech) Then Cancel = True MsgBox "Please enter your name." End If If IsNull(Me.Parent.fWorkLog!StartTime) Then Cancel = True MsgBox "Please enter date for this comment in Start Time." End If End Sub |
#2
|
|||
|
|||
Set Focus
In your table desing you should declare them as required fields.
Daniel "Pam" wrote: I have a main form "fGeneralInfo" with subform "fWorkLog" and subform "fWorkLogComments". When user enters comments to subform fWorkLogComments and they don't enter their name and date in fWorkLog.CboTech and fWorkLog.StartTime, I want a msg to pop up telling them to do so and to set the focus to CboTech and then StartTime if both are not filled in. I have the following code on BeforeUpdate of the subform "fWorkLogComments". I have entered may combinations of SetFocus and can get nothing to work. The message will pop up, but if user clicks ok at each one, they will eventually leave the form. I really need to have Tech and StartTimes required for these entries. I would very much appreciate any help with this. Pam Private Sub Form_BeforeUpdate(Cancel As Integer) If IsNull(Me.Parent.fWorkLog!Tech) Then Cancel = True MsgBox "Please enter your name." End If If IsNull(Me.Parent.fWorkLog!StartTime) Then Cancel = True MsgBox "Please enter date for this comment in Start Time." End If End Sub |
#3
|
|||
|
|||
Set Focus
Daniel,
Thanks for the reply. I tried this and received the message "Existing data violates the new setting for the 'Required' property for field 'Tech'. Pam .. "Daniel" wrote in message ... In your table desing you should declare them as required fields. Daniel "Pam" wrote: I have a main form "fGeneralInfo" with subform "fWorkLog" and subform "fWorkLogComments". When user enters comments to subform fWorkLogComments and they don't enter their name and date in fWorkLog.CboTech and fWorkLog.StartTime, I want a msg to pop up telling them to do so and to set the focus to CboTech and then StartTime if both are not filled in. I have the following code on BeforeUpdate of the subform "fWorkLogComments". I have entered may combinations of SetFocus and can get nothing to work. The message will pop up, but if user clicks ok at each one, they will eventually leave the form. I really need to have Tech and StartTimes required for these entries. I would very much appreciate any help with this. Pam Private Sub Form_BeforeUpdate(Cancel As Integer) If IsNull(Me.Parent.fWorkLog!Tech) Then Cancel = True MsgBox "Please enter your name." End If If IsNull(Me.Parent.fWorkLog!StartTime) Then Cancel = True MsgBox "Please enter date for this comment in Start Time." End If End Sub |
#4
|
|||
|
|||
Set Focus
Pam,
Some of the records may have no data (Null) in that field. Make sure that the field has data in *all* recrods before you change the setting to "Required=Yes" Further, I suggest that in addition to Reuired, set "Allow Zero Length" to "No", if the option is there.. Regards Jacob .. Pam wrote: Daniel, Thanks for the reply. I tried this and received the message "Existing data violates the new setting for the 'Required' property for field 'Tech'. Pam . "Daniel" wrote in message ... In your table desing you should declare them as required fields. Daniel "Pam" wrote: I have a main form "fGeneralInfo" with subform "fWorkLog" and subform "fWorkLogComments". When user enters comments to subform fWorkLogComments and they don't enter their name and date in fWorkLog.CboTech and fWorkLog.StartTime, I want a msg to pop up telling them to do so and to set the focus to CboTech and then StartTime if both are not filled in. I have the following code on BeforeUpdate of the subform "fWorkLogComments". I have entered may combinations of SetFocus and can get nothing to work. The message will pop up, but if user clicks ok at each one, they will eventually leave the form. I really need to have Tech and StartTimes required for these entries. I would very much appreciate any help with this. Pam Private Sub Form_BeforeUpdate(Cancel As Integer) If IsNull(Me.Parent.fWorkLog!Tech) Then Cancel = True MsgBox "Please enter your name." End If If IsNull(Me.Parent.fWorkLog!StartTime) Then Cancel = True MsgBox "Please enter date for this comment in Start Time." End If End Sub |
Thread Tools | |
Display Modes | |
|
|