Question If Formulas in An Access Form

mitch_johnson

Registered User.
Local time
Yesterday, 23:06
Joined
Mar 18, 2009
Messages
40
Hello, is there anyway in a access form to set a kind of "IF" formula for example if the yes/no box in one field is set to yes then that changes the data in another field.

hope you understand thanks
 
Hello, is there anyway in a access form to set a kind of "IF" formula for example if the yes/no box in one field is set to yes then that changes the data in another field.

hope you understand thanks

If you are looking for a Conditional using SQL you can use something like:
Code:
[B]   IIf[/B]([B]{Condition to Test}[/B], [B]{Action if TRUE}[/B], [B]{Action if FALSE}[/B])
If you are looking for a Conditional using Visual Basic you can use something like:
Code:
[B]   If [/B]([B]{Condition to Test}[/B])[B] Then[/B]
[B]       {Action if TRUE}[/B]
[B]   Else[/B]
[B][B]       {Action if FALSE}[/B][/B]
[B]   End If[/B]
 
great sorry but i am quite new would you be able to give me a step by step with an example thanks
 
for example when a yes/no box is ticked it enters £0.00 into a field names Final Balance:
 
In the After Update event of the checkbox put

Me.YourFinalBalanceTextBoxNameHere = "£0.00"

if the field is not text (as you can't use the £ if it is not a text field) and is just numeric then it would be:

Me.YourFinalBalanceTextBoxNameHere = 0

and you would use the text box's FORMAT property to set the formatting.
 
thank you can i also ask you how to delete data from a field on cue so when i click say a button data from a perticular field gets deleted thanks
 
To delete data from a button click for

a single text box (if the data is text, memo, or numeric) - Me.YourTextBoxNameHere = ""

a single text box (if the data is a date field) - Me.YourTextBoxNameHere = NULL

a combo box - Me.YourComboBoxNameHere = NULL

a single select list box - Me.YourListBoxNameHere = NULL


or delete an entire record that you are currently on:

Screen.PreviousControl.SetFocus
DoCmd.RunCommand acCmdDeleteRecord
 
thank you so much for your help its nice to know there are some genuine people willing to help out there can i just ask one more thing please:

i have a drop down list how do i make it so that when i select a certain item of the drop down list it sets another fields data eg:
when i select an apple from my fruit drop down list it sets the price field to 80p thanks
 
thank you so much for your help its nice to know there are some genuine people willing to help out there can i just ask one more thing please:

i have a drop down list how do i make it so that when i select a certain item of the drop down list it sets another fields data eg:
when i select an apple from my fruit drop down list it sets the price field to 80p thanks

You should include that price in the combo box and then you can refer to the combo box for the value. Check out my sample that is for just this type of thing here:
http://downloads.btabdevelopment.com/Samples/combos/Sample-FillInFields.zip
 
brill thats great and sorry but whats the code to completly delete a record on the click of a button
 
yeah sorry i missed that do you also know how to do the following:
if i click a link to open a different form from a form how do i make it automaticly show the same record i was looking at on the previous form

thanks
 

Users who are viewing this thread

Back
Top Bottom