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
|
|||
|
|||
Validation Rule
I have a subform that loads into the main form after the user selects that
tab on the main form (tabctrl event). I have a cmbo box called cmbDisposition. If the user selects "Settlement Reached" a series of other controls become enabled. One of the controls is [CSADate]. I want the user to be required to input a date into this field before being able to move onto another record. I tried this Validation Rule, but it didn't work: =IIf(([cmbDisposition]="Settlement Reached"), IsNotNull([CSADate])) How do I fix this expression? TIA S. Jackson |
#2
|
|||
|
|||
Validation Rule
Try something like the following in the form's after update...
Private Sub Form_AfterUpdate() a: On Error GoTo Err_Form_Afterupdate Do While (([cmbDisposition]="Settlement Reached") and IsNull([CSADate])) Dim strInput As String strInput = InputBox("CSA Date is required") If strInput "" Then Do While strInput 0 Or strInput 1 strInput = InputBox(strMsg) Loop SCADate = strInput End If Loop Exit_Form_Afterupdate: Exit Sub Err_Form_Afterupdate: GoTo a End Sub Rick B "S Jackson" wrote in message ... I have a subform that loads into the main form after the user selects that tab on the main form (tabctrl event). I have a cmbo box called cmbDisposition. If the user selects "Settlement Reached" a series of other controls become enabled. One of the controls is [CSADate]. I want the user to be required to input a date into this field before being able to move onto another record. I tried this Validation Rule, but it didn't work: =IIf(([cmbDisposition]="Settlement Reached"), IsNotNull([CSADate])) How do I fix this expression? TIA S. Jackson |
#3
|
|||
|
|||
Validation Rule
Oops - I copied that code from my database. You can remove or to change the
line... Do While strInput 0 Or strInput 1 ....to fit your edits. Rick B "Rick B" wrote in message ... Try something like the following in the form's after update... Private Sub Form_AfterUpdate() a: On Error GoTo Err_Form_Afterupdate Do While (([cmbDisposition]="Settlement Reached") and IsNull([CSADate])) Dim strInput As String strInput = InputBox("CSA Date is required") If strInput "" Then Do While strInput 0 Or strInput 1 strInput = InputBox(strMsg) Loop SCADate = strInput End If Loop Exit_Form_Afterupdate: Exit Sub Err_Form_Afterupdate: GoTo a End Sub Rick B "S Jackson" wrote in message ... I have a subform that loads into the main form after the user selects that tab on the main form (tabctrl event). I have a cmbo box called cmbDisposition. If the user selects "Settlement Reached" a series of other controls become enabled. One of the controls is [CSADate]. I want the user to be required to input a date into this field before being able to move onto another record. I tried this Validation Rule, but it didn't work: =IIf(([cmbDisposition]="Settlement Reached"), IsNotNull([CSADate])) How do I fix this expression? TIA S. Jackson |
#4
|
|||
|
|||
Validation Rule
Rick,
Validation functions like that should go in the form's BeforeUpdate event. It's too late by the time you get to the AfterUpdate event -- the record has already been written. -- Lynn Trapp MS Access MVP www.ltcomputerdesigns.com Access Security: www.ltcomputerdesigns.com/Security.htm "Rick B" wrote in message ... Try something like the following in the form's after update... Private Sub Form_AfterUpdate() a: On Error GoTo Err_Form_Afterupdate Do While (([cmbDisposition]="Settlement Reached") and IsNull([CSADate])) Dim strInput As String strInput = InputBox("CSA Date is required") If strInput "" Then Do While strInput 0 Or strInput 1 strInput = InputBox(strMsg) Loop SCADate = strInput End If Loop Exit_Form_Afterupdate: Exit Sub Err_Form_Afterupdate: GoTo a End Sub Rick B "S Jackson" wrote in message ... I have a subform that loads into the main form after the user selects that tab on the main form (tabctrl event). I have a cmbo box called cmbDisposition. If the user selects "Settlement Reached" a series of other controls become enabled. One of the controls is [CSADate]. I want the user to be required to input a date into this field before being able to move onto another record. I tried this Validation Rule, but it didn't work: =IIf(([cmbDisposition]="Settlement Reached"), IsNotNull([CSADate])) How do I fix this expression? TIA S. Jackson |
#5
|
|||
|
|||
Validation Rule
Rick:
Thank you so much for your prompt reply. I managed to get the code to work. I took out the Do While Statement within the If statement. However, my understanding of VB is extremely basic and I have a question about the code. I figure since I am going to use it, I need to understand what it is doing. I looked in my handbook, but can't figure this part out: If strInput "" Then Forgive my ignorance, but doesn't that statement say: If strInput (the Input Box) is less than or greater than "" Then . . . Oh boy, in my ignorance, I can't even figure out how to ask what I want to know. Huh, . .. does it mean that if the user doesn't put anything in the Input box (less than) or the user "does" put something in the Input box (greater than), CSA=strInput? To me that means the user is allowed to exit the Input box (less than) without making an entry. I did tested the code out and it does work - the user cannot exit the input box unless they put in a date. But, I just don't understand how based on my understanding of the above statement. What part of the code forces the user to make an entry into the Input box? The Input box itself? Save me from my ignorance. S. Jackson "Rick B" wrote in message ... Oops - I copied that code from my database. You can remove or to change the line... Do While strInput 0 Or strInput 1 ...to fit your edits. Rick B "Rick B" wrote in message ... Try something like the following in the form's after update... Private Sub Form_AfterUpdate() a: On Error GoTo Err_Form_Afterupdate Do While (([cmbDisposition]="Settlement Reached") and IsNull([CSADate])) Dim strInput As String strInput = InputBox("CSA Date is required") If strInput "" Then Do While strInput 0 Or strInput 1 strInput = InputBox(strMsg) Loop SCADate = strInput End If Loop Exit_Form_Afterupdate: Exit Sub Err_Form_Afterupdate: GoTo a End Sub Rick B "S Jackson" wrote in message ... I have a subform that loads into the main form after the user selects that tab on the main form (tabctrl event). I have a cmbo box called cmbDisposition. If the user selects "Settlement Reached" a series of other controls become enabled. One of the controls is [CSADate]. I want the user to be required to input a date into this field before being able to move onto another record. I tried this Validation Rule, but it didn't work: =IIf(([cmbDisposition]="Settlement Reached"), IsNotNull([CSADate])) How do I fix this expression? TIA S. Jackson |
#6
|
|||
|
|||
Validation Rule
That is simply saying that if the user makes an entry, then check to see
that it is between 0 and 1 (in my case). You could probably do the same thing by saying something like.. If IsNotNull(strInput) Then What requires it to be enterd are the... Do While (([cmbDisposition]="Settlement Reached") and IsNull([CSADate])) Loop Rick B to leave the message box blank (in other words, enters a value equal to "", then...) In this case, it keeps asking. You could do something like pop up another message that says "entry is required" and the loop back to asking for an entry. All your questions are about the same thing. You asked what the "" and Hope that helps, Rick B "S Jackson" wrote in message ... Rick: Thank you so much for your prompt reply. I managed to get the code to work. I took out the Do While Statement within the If statement. However, my understanding of VB is extremely basic and I have a question about the code. I figure since I am going to use it, I need to understand what it is doing. I looked in my handbook, but can't figure this part out: If strInput "" Then Forgive my ignorance, but doesn't that statement say: If strInput (the Input Box) is less than or greater than "" Then . . . Oh boy, in my ignorance, I can't even figure out how to ask what I want to know. Huh, . .. does it mean that if the user doesn't put anything in the Input box (less than) or the user "does" put something in the Input box (greater than), CSA=strInput? To me that means the user is allowed to exit the Input box (less than) without making an entry. I did tested the code out and it does work - the user cannot exit the input box unless they put in a date. But, I just don't understand how based on my understanding of the above statement. What part of the code forces the user to make an entry into the Input box? The Input box itself? Save me from my ignorance. S. Jackson "Rick B" wrote in message ... Oops - I copied that code from my database. You can remove or to change the line... Do While strInput 0 Or strInput 1 ...to fit your edits. Rick B "Rick B" wrote in message ... Try something like the following in the form's after update... Private Sub Form_AfterUpdate() a: On Error GoTo Err_Form_Afterupdate Do While (([cmbDisposition]="Settlement Reached") and IsNull([CSADate])) Dim strInput As String strInput = InputBox("CSA Date is required") If strInput "" Then Do While strInput 0 Or strInput 1 strInput = InputBox(strMsg) Loop SCADate = strInput End If Loop Exit_Form_Afterupdate: Exit Sub Err_Form_Afterupdate: GoTo a End Sub Rick B "S Jackson" wrote in message ... I have a subform that loads into the main form after the user selects that tab on the main form (tabctrl event). I have a cmbo box called cmbDisposition. If the user selects "Settlement Reached" a series of other controls become enabled. One of the controls is [CSADate]. I want the user to be required to input a date into this field before being able to move onto another record. I tried this Validation Rule, but it didn't work: =IIf(([cmbDisposition]="Settlement Reached"), IsNotNull([CSADate])) How do I fix this expression? TIA S. Jackson |
#7
|
|||
|
|||
Validation Rule
Lynn is correct. I just tried it and was able to get around it.
Rick B "Lynn Trapp" wrote in message ... Rick, Validation functions like that should go in the form's BeforeUpdate event. It's too late by the time you get to the AfterUpdate event -- the record has already been written. -- Lynn Trapp MS Access MVP www.ltcomputerdesigns.com Access Security: www.ltcomputerdesigns.com/Security.htm "Rick B" wrote in message ... Try something like the following in the form's after update... Private Sub Form_AfterUpdate() a: On Error GoTo Err_Form_Afterupdate Do While (([cmbDisposition]="Settlement Reached") and IsNull([CSADate])) Dim strInput As String strInput = InputBox("CSA Date is required") If strInput "" Then Do While strInput 0 Or strInput 1 strInput = InputBox(strMsg) Loop SCADate = strInput End If Loop Exit_Form_Afterupdate: Exit Sub Err_Form_Afterupdate: GoTo a End Sub Rick B "S Jackson" wrote in message ... I have a subform that loads into the main form after the user selects that tab on the main form (tabctrl event). I have a cmbo box called cmbDisposition. If the user selects "Settlement Reached" a series of other controls become enabled. One of the controls is [CSADate]. I want the user to be required to input a date into this field before being able to move onto another record. I tried this Validation Rule, but it didn't work: =IIf(([cmbDisposition]="Settlement Reached"), IsNotNull([CSADate])) How do I fix this expression? TIA S. Jackson |
#8
|
|||
|
|||
Validation Rule
If IsNotNull(strInput) results in a error during compliation:
Sub or Function not defined. S. Jackson "Rick B" wrote in message ... That is simply saying that if the user makes an entry, then check to see that it is between 0 and 1 (in my case). You could probably do the same thing by saying something like.. If IsNotNull(strInput) Then What requires it to be enterd are the... Do While (([cmbDisposition]="Settlement Reached") and IsNull([CSADate])) Loop Rick B to leave the message box blank (in other words, enters a value equal to "", then...) In this case, it keeps asking. You could do something like pop up another message that says "entry is required" and the loop back to asking for an entry. All your questions are about the same thing. You asked what the "" and Hope that helps, Rick B "S Jackson" wrote in message ... Rick: Thank you so much for your prompt reply. I managed to get the code to work. I took out the Do While Statement within the If statement. However, my understanding of VB is extremely basic and I have a question about the code. I figure since I am going to use it, I need to understand what it is doing. I looked in my handbook, but can't figure this part out: If strInput "" Then Forgive my ignorance, but doesn't that statement say: If strInput (the Input Box) is less than or greater than "" Then . . . Oh boy, in my ignorance, I can't even figure out how to ask what I want to know. Huh, .. . does it mean that if the user doesn't put anything in the Input box (less than) or the user "does" put something in the Input box (greater than), CSA=strInput? To me that means the user is allowed to exit the Input box (less than) without making an entry. I did tested the code out and it does work - the user cannot exit the input box unless they put in a date. But, I just don't understand how based on my understanding of the above statement. What part of the code forces the user to make an entry into the Input box? The Input box itself? Save me from my ignorance. S. Jackson "Rick B" wrote in message ... Oops - I copied that code from my database. You can remove or to change the line... Do While strInput 0 Or strInput 1 ...to fit your edits. Rick B "Rick B" wrote in message ... Try something like the following in the form's after update... Private Sub Form_AfterUpdate() a: On Error GoTo Err_Form_Afterupdate Do While (([cmbDisposition]="Settlement Reached") and IsNull([CSADate])) Dim strInput As String strInput = InputBox("CSA Date is required") If strInput "" Then Do While strInput 0 Or strInput 1 strInput = InputBox(strMsg) Loop SCADate = strInput End If Loop Exit_Form_Afterupdate: Exit Sub Err_Form_Afterupdate: GoTo a End Sub Rick B "S Jackson" wrote in message ... I have a subform that loads into the main form after the user selects that tab on the main form (tabctrl event). I have a cmbo box called cmbDisposition. If the user selects "Settlement Reached" a series of other controls become enabled. One of the controls is [CSADate]. I want the user to be required to input a date into this field before being able to move onto another record. I tried this Validation Rule, but it didn't work: =IIf(([cmbDisposition]="Settlement Reached"), IsNotNull([CSADate])) How do I fix this expression? TIA S. Jackson |
#9
|
|||
|
|||
Validation Rule
Why do I need an "If statement" at all if its the first statement that
forces the user to make the entry? Why can't I simply put: CSADate = strInput S. Jackson "Rick B" wrote in message ... That is simply saying that if the user makes an entry, then check to see that it is between 0 and 1 (in my case). You could probably do the same thing by saying something like.. If IsNotNull(strInput) Then What requires it to be enterd are the... Do While (([cmbDisposition]="Settlement Reached") and IsNull([CSADate])) Loop Rick B to leave the message box blank (in other words, enters a value equal to "", then...) In this case, it keeps asking. You could do something like pop up another message that says "entry is required" and the loop back to asking for an entry. All your questions are about the same thing. You asked what the "" and Hope that helps, Rick B "S Jackson" wrote in message ... Rick: Thank you so much for your prompt reply. I managed to get the code to work. I took out the Do While Statement within the If statement. However, my understanding of VB is extremely basic and I have a question about the code. I figure since I am going to use it, I need to understand what it is doing. I looked in my handbook, but can't figure this part out: If strInput "" Then Forgive my ignorance, but doesn't that statement say: If strInput (the Input Box) is less than or greater than "" Then . . . Oh boy, in my ignorance, I can't even figure out how to ask what I want to know. Huh, .. . does it mean that if the user doesn't put anything in the Input box (less than) or the user "does" put something in the Input box (greater than), CSA=strInput? To me that means the user is allowed to exit the Input box (less than) without making an entry. I did tested the code out and it does work - the user cannot exit the input box unless they put in a date. But, I just don't understand how based on my understanding of the above statement. What part of the code forces the user to make an entry into the Input box? The Input box itself? Save me from my ignorance. S. Jackson "Rick B" wrote in message ... Oops - I copied that code from my database. You can remove or to change the line... Do While strInput 0 Or strInput 1 ...to fit your edits. Rick B "Rick B" wrote in message ... Try something like the following in the form's after update... Private Sub Form_AfterUpdate() a: On Error GoTo Err_Form_Afterupdate Do While (([cmbDisposition]="Settlement Reached") and IsNull([CSADate])) Dim strInput As String strInput = InputBox("CSA Date is required") If strInput "" Then Do While strInput 0 Or strInput 1 strInput = InputBox(strMsg) Loop SCADate = strInput End If Loop Exit_Form_Afterupdate: Exit Sub Err_Form_Afterupdate: GoTo a End Sub Rick B "S Jackson" wrote in message ... I have a subform that loads into the main form after the user selects that tab on the main form (tabctrl event). I have a cmbo box called cmbDisposition. If the user selects "Settlement Reached" a series of other controls become enabled. One of the controls is [CSADate]. I want the user to be required to input a date into this field before being able to move onto another record. I tried this Validation Rule, but it didn't work: =IIf(([cmbDisposition]="Settlement Reached"), IsNotNull([CSADate])) How do I fix this expression? TIA S. Jackson |
#10
|
|||
|
|||
Validation Rule
You are checking to see if the user made an entry when asked.
The box pops up and tells the user to enter a date. What if the user ignores it ans simply presses the enter key, without entering a date? Rick B "S Jackson" wrote in message ... Why do I need an "If statement" at all if its the first statement that forces the user to make the entry? Why can't I simply put: CSADate = strInput S. Jackson "Rick B" wrote in message ... That is simply saying that if the user makes an entry, then check to see that it is between 0 and 1 (in my case). You could probably do the same thing by saying something like.. If IsNotNull(strInput) Then What requires it to be enterd are the... Do While (([cmbDisposition]="Settlement Reached") and IsNull([CSADate])) Loop Rick B to leave the message box blank (in other words, enters a value equal to "", then...) In this case, it keeps asking. You could do something like pop up another message that says "entry is required" and the loop back to asking for an entry. All your questions are about the same thing. You asked what the "" and Hope that helps, Rick B "S Jackson" wrote in message ... Rick: Thank you so much for your prompt reply. I managed to get the code to work. I took out the Do While Statement within the If statement. However, my understanding of VB is extremely basic and I have a question about the code. I figure since I am going to use it, I need to understand what it is doing. I looked in my handbook, but can't figure this part out: If strInput "" Then Forgive my ignorance, but doesn't that statement say: If strInput (the Input Box) is less than or greater than "" Then . . . Oh boy, in my ignorance, I can't even figure out how to ask what I want to know. Huh, .. . does it mean that if the user doesn't put anything in the Input box (less than) or the user "does" put something in the Input box (greater than), CSA=strInput? To me that means the user is allowed to exit the Input box (less than) without making an entry. I did tested the code out and it does work - the user cannot exit the input box unless they put in a date. But, I just don't understand how based on my understanding of the above statement. What part of the code forces the user to make an entry into the Input box? The Input box itself? Save me from my ignorance. S. Jackson "Rick B" wrote in message ... Oops - I copied that code from my database. You can remove or to change the line... Do While strInput 0 Or strInput 1 ...to fit your edits. Rick B "Rick B" wrote in message ... Try something like the following in the form's after update... Private Sub Form_AfterUpdate() a: On Error GoTo Err_Form_Afterupdate Do While (([cmbDisposition]="Settlement Reached") and IsNull([CSADate])) Dim strInput As String strInput = InputBox("CSA Date is required") If strInput "" Then Do While strInput 0 Or strInput 1 strInput = InputBox(strMsg) Loop SCADate = strInput End If Loop Exit_Form_Afterupdate: Exit Sub Err_Form_Afterupdate: GoTo a End Sub Rick B "S Jackson" wrote in message ... I have a subform that loads into the main form after the user selects that tab on the main form (tabctrl event). I have a cmbo box called cmbDisposition. If the user selects "Settlement Reached" a series of other controls become enabled. One of the controls is [CSADate]. I want the user to be required to input a date into this field before being able to move onto another record. I tried this Validation Rule, but it didn't work: =IIf(([cmbDisposition]="Settlement Reached"), IsNotNull([CSADate])) How do I fix this expression? TIA S. Jackson |
|
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Validation Rule | [email protected] | Database Design | 1 | June 23rd, 2004 05:51 PM |
HELP!!! Validation rule | Chris | Running & Setting Up Queries | 4 | June 1st, 2004 01:11 PM |
HELP!!! Validation rule | Chris | Using Forms | 7 | June 1st, 2004 01:11 PM |
Validation Rule | Tom | Database Design | 3 | May 18th, 2004 10:27 PM |
Format cell using Validation rule | DDM | Worksheet Functions | 5 | May 3rd, 2004 10:17 PM |