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

Function in Form



 
 
Thread Tools Display Modes
  #1  
Old December 14th, 2006, 07:59 PM posted to microsoft.public.access.forms
Dee
external usenet poster
 
Posts: 644
Default 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  
Old December 14th, 2006, 09:05 PM posted to microsoft.public.access.forms
Al Campagna
external usenet poster
 
Posts: 421
Default 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  
Old December 14th, 2006, 09:56 PM posted to microsoft.public.access.forms
Fatma
external usenet poster
 
Posts: 1
Default 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  
Old December 14th, 2006, 10:21 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default 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

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


All times are GMT +1. The time now is 01:35 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.