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
|
|||
|
|||
Function in Form
I have a form in my database that has 4 yes/No fields. I want to create
another field that if all the responses in the 4 questions is yes then the other field will say "yes" for example the questions would be Was report 1 completed Yes/No Was report 2 completed Yes/No Was report 3 completed Yes/No Was report 4 completed Yes/No The 5th field would be Customer Requires Payment Yes/No So if the answers to question 1-4 are checked "yes" then the "customer requires payment" should automatically be checked. So I would need to create a function that would say "if field one and field 2 and field 3 and field 4 = Yes then field 5 = Yes Is there are way to do this? Does anyone know where I could get infomation on how to do this? I am using Access 2003. Thanks in advance for any help. Best regards, Dee |
#2
|
|||
|
|||
Function in Form
Dee,
Put this code behind the AfterUpdate event of each of the 4 elements... (assuming PaymentReq is a bound field) If F1 = True and F2 = True and F3 = True and F4 = True Then PaymentReq = True Else PaymentReq = False End If -------------------- Or.. PaymentReq = F1 = True and F2 = True -- hth Al Campagna Candia Computer Consulting - Candia NH http://home.comcast.net/~cccsolutions "Dee" wrote in message ... I have a form in my database that has 4 yes/No fields. I want to create another field that if all the responses in the 4 questions is yes then the other field will say "yes" for example the questions would be Was report 1 completed Yes/No Was report 2 completed Yes/No Was report 3 completed Yes/No Was report 4 completed Yes/No The 5th field would be Customer Requires Payment Yes/No So if the answers to question 1-4 are checked "yes" then the "customer requires payment" should automatically be checked. So I would need to create a function that would say "if field one and field 2 and field 3 and field 4 = Yes then field 5 = Yes Is there are way to do this? Does anyone know where I could get infomation on how to do this? I am using Access 2003. Thanks in advance for any help. Best regards, Dee |
#3
|
|||
|
|||
Function in Form
hi Dee
I used a check boxes here for yes /no fields I think you can put a command button having a code like: ------------------------------------ Private Sub Command8_Click() If Me.Check1.Value = -1 And Me.Check2 = -1 And Me.Check3 = -1 And Me.Check4 = -1 Then Me.CheckCRP.Value = -1 Else Me.Check6.CRP = 0 End If End Sub --------------------------------- Or if u don't wanna use a button u can use the after update event for each check box ----------------------------------------------- Private Sub Check1_AfterUpdate() If Me.Check1.Value = -1 And Me.Check2 = -1 And Me.Check3 = -1 And Me.Check4 = -1 Then Me.CheckCRP.Value = -1 Else Me.Check6.CRP = 0 End If End Sub --------------------------------------- Private Sub Check2_AfterUpdate() If Me.Check1.Value = -1 And Me.Check2 = -1 And Me.Check3 = -1 And Me.Check4 = -1 Then Me.CheckCRP.Value = -1 Else Me.Check6.CRP = 0 End If End Sub -------------------------------------- Private Sub Check3_AfterUpdate() If Me.Check1.Value = -1 And Me.Check2 = -1 And Me.Check3 = -1 And Me.Check4 = -1 Then Me.CheckCRP.Value = -1 Else Me.Check6.CRP = 0 End If End Sub ------------------------------------- Private Sub Check4_AfterUpdate() If Me.Check1.Value = -1 And Me.Check2 = -1 And Me.Check3 = -1 And Me.Check4 = -1 Then Me.CheckCRP.Value = -1 Else Me.Check6.CRP = 0 End If End Sub -------------------------------------- and u can set the Enable to No & the Locked to yes in the properties of the Customer Requires Payment check box "Dee" wrote in message ... I have a form in my database that has 4 yes/No fields. I want to create another field that if all the responses in the 4 questions is yes then the other field will say "yes" for example the questions would be Was report 1 completed Yes/No Was report 2 completed Yes/No Was report 3 completed Yes/No Was report 4 completed Yes/No The 5th field would be Customer Requires Payment Yes/No So if the answers to question 1-4 are checked "yes" then the "customer requires payment" should automatically be checked. So I would need to create a function that would say "if field one and field 2 and field 3 and field 4 = Yes then field 5 = Yes Is there are way to do this? Does anyone know where I could get infomation on how to do this? I am using Access 2003. Thanks in advance for any help. Best regards, Dee |
#4
|
|||
|
|||
Function in Form
And for a slightly different approach:
With Me .chkCustRequiresPmt = Abs(.Report1 + .Report2 + .Report3 + .Report4) = 4 End With "Dee" wrote: I have a form in my database that has 4 yes/No fields. I want to create another field that if all the responses in the 4 questions is yes then the other field will say "yes" for example the questions would be Was report 1 completed Yes/No Was report 2 completed Yes/No Was report 3 completed Yes/No Was report 4 completed Yes/No The 5th field would be Customer Requires Payment Yes/No So if the answers to question 1-4 are checked "yes" then the "customer requires payment" should automatically be checked. So I would need to create a function that would say "if field one and field 2 and field 3 and field 4 = Yes then field 5 = Yes Is there are way to do this? Does anyone know where I could get infomation on how to do this? I am using Access 2003. Thanks in advance for any help. Best regards, Dee |
Thread Tools | |
Display Modes | |
|
|