Forms :: Conditional Mandatory Fields
Mar 20, 2013
Basically I have a form which records primary and secondary reasons for people writing off money, and in the secondary reasons I have an option for 'other', in case any of the other options aren't applicable. There is also a comments section on the form which is optional.
My issue is, I want the comments section to become mandatory if the 'other' option has been selected. I don't want it mandatory all the time, and I don't want it disabled if 'other' isn't selected, but I need to force people to write at least something in there if they have selected other.
I tried variations on code I found from other places but was unable to get this to function, and I am not sure if this can be done with validation or something like that.
View Replies
ADVERTISEMENT
Jun 14, 2005
Hi,
I am experiencing a few problems with mandatory fields in my forms. I use different forms which all base on the same table - therefore I can not use the "Required"-flag in the table definitions.
What I managed to do by now:
I put this statement into the OnExit-Event:
=IIf([FMNO] Is Null,MsgBox("Please enter the FMNO",48,"Error Message"),"")
This provides me with an errormessage in case the field is null.
When I exit the field, I receive the errormessage but the cursor moves to the next field. How can I make sure that the cursor stays in the field where the error occurs?
My next problem:
When I try to use this syntax on a text-field (e.g. "NAME") it doesn't work.
Has anybody any suggestions?
Your help is very much appreciated, I'm getting more and more desperate on this issue.
View 2 Replies
View Related
Jun 18, 2013
I have a table, which when i first set it up i decided that a couple of the fields had to be mandatory.
So, i set the "Required" property of the field to "Yes" (at table level - which is probably poor practice?)
I now have a form that allows a user at the front end to enter items in the table.
If they complete all the fields on the form i have used macro builder to save the record, present a nice message and move to a New Record. (3 elements in all)
However, if they try to save the record having not completed the "Required" fields then they get an error message instructing them the field is required, but then the macro crashes.
So what's the best way to approach Mandatory fields? Is it best to leave the "Required" property at table level set to No and then have something at form level which checks they have entered a value in the field? (i'm guessing this is probably the correct approach)
I tried removing the table level condition from the [Field] and adding this as the first argument of the macro builder which saves my record:
Code:
IF [Field] = "" Then
MessageBox "You Must Complete Mandatory Fields"
Stop Macro
End If
But my macro still completes and saves the record...
View 6 Replies
View Related
May 11, 2013
I have a form with lots of combo boxes and text boxes. They are all linked to various MS Access tables and some of the fields are mandatory. I would like do an check to see if all the mandatory fields are not null i.e. are populated with a value and then run an update query for my master table in the database to flag the records as being complete if all the mandatory fields are populated.
If (IsEmpty(tab1.cmb_a)) Then do something
But I am just blank at the moment on how to proceed, especially on how I can do all the checks and then populate the database.
View 3 Replies
View Related
Nov 4, 2014
I have a form with 2 sub forms which have identical fields from different records. I want to use conditional formatting to indicate a mismatch between 2 of the identical fields. I have been told I should use [NewField] <> [OldField] but I don't know how to complete the syntax. If I call the first sub_form_1 and the second sub_form_2 and the field name is path_length on both, how do I compile the statement?
View 8 Replies
View Related
Aug 1, 2013
I have a form in datasheet with the fields "Date In" and "Date out" among other.
I want to be able to Change the backcolour of the "Date In" to red, yellow, or green depending on the length of time elapsed between current date and date in. This works fine on the conditional formatting, but now I only want to apply this formatting IF the "Date Out" is empty.
Access 2007.
View 3 Replies
View Related
May 15, 2013
I am trying to provide a visual highlight for users of a multi tabbed form. I do a check as users go from tab and tab and i.e. on exit event and I would like to highlight all mandatory fields that have been left incomplete.
I did a test with one control and it worked as expected with the after update event of the specific control.
I then altered the code to add another control, but it does not work as expected. It only highlights one control and not the other. I just recently started using vba, I adapt the code to fit multiple controls and make it work as expected.
Private Sub Ctl2_frm_tab1_Exit(Cancel As Integer)
If (Len(Form_2.cmb_arName& "") = 0 Or IsNull(Form_2.cmb_arName)) Or _
(Len(Form_2.cmb_val & "") = 0 Or IsNull(Form_2.cmb_val)) Then
Cancel = True
MsgBox "Please complete the highlighted control", vbCritical + vbOKOnly
[Code] .....
View 3 Replies
View Related
May 11, 2014
How to have a message appear if the "Symbol_Stock" field is blank.
View 14 Replies
View Related
Aug 12, 2011
I have text boxes that combine two fields into one, for example the control source is =IIf(IsNull([BuckC])=True And IsNull([BoostC])=True,"",[BuckC] & " , " & [BoostC]) . For simple its just =[Buckc] + ": "+[BoostC]. I am trying to set a condition that if one of them exceeds a certain number the background color will change to yellow. I know how to do this if its only for one field but I am wondering if it is possible to do it with multiple fields?
View 9 Replies
View Related
Jan 24, 2008
Hello All,
I have searched the forum but I don't quite get what I am looking for.
I have a subform that has these 2 fields:
- Status
- LastFollowup
What I want is if the Status shows "Pending" and the date entered on the LastFollowup is more than 7 days. Then it should turn Yellow.
I tried this code in the expression box but it doesn't seem to work
[Status]="Pending" and [LastFollowup]>7
Could anyone please assist? I know this is simple but it's not working for me.
Thank you
View 6 Replies
View Related
Mar 1, 2007
Hi all, sorry to bother you all, especially if this has already been answered, but I can't seem to find the solution to it. Assuming that what I've been doing has been correct that is.
I have three (3) tables with the following fields (where PK is primary key);
[tbl Ingred]: IngredID (PK), ProdID_fk, CompCode, IngredName, Weight, Symbol, RP01, RP02, RP03, RP04, RP05, RP06, RP07, RP08, RP09, RP10
[tbl Prod]: ProdID (PK), ProdName, FP, BP, SBU, ProdNotes
[tbl RPCalc]: RPs, RPs_long (PK), Sym, Limit, Sym_1, RP_1, Comp_1, Add, RP_01, RPNotes
[tbl Prod] has a one-to-many relationship with [tbl Ingred]; that is, for one ProdID, there can be many IngredIDs. The tables are designed so that the final user-displayed form is 'user-friendly'.
I've made a qry called [qry Qcalc] used to calculate the the Quotation (Q) of each of the 10 RPs (RP01 - RP10). Which simply for the first one is; QRP01: [Weight]/[tbl RPCalc_1].Limit, where the [tbl Ingred].[RP01] is linked to a corresponding [tbl RPCalc], by the [RPs] field. As for one [RPs] there may be multiple [RPs_long]. The way it is set up is so that the [RPs] and [RPs_long] are mapped correctly, to be used for calculations.
However, I am now stuck with a problem. I need to sum up these QRP values ([QRP01] - [QRP10]), based on (at least?) two conditions. The user can enter in their RPs; e.g. R10, R20, R21 in any of the [RP01] to [RP10]'s, and in any order.
What I need is to be able to obtain a sum of the Q values for each [RPs_long] (e.g. R10, R20, R21), rather than being the sum of the fields [RP01] to [RP10]. Also, each [RPs_long] may or may not be able to be summed up, depending on another field [Add] which has a "Yes" or "No". "Yes" is for it being able to be summed up, and "No" for it not being additive.
So the end result would be; for each [ProdID], there will be multiple [IngredID] where each will have up to ten (10) "RPs" (that being the [RP01] to [RP10] fields). These inputted "RPs" are then related to [tbl RPCalc] to be able to obtain the Q-values. If the Q-Value is not greater or equal to 1 (>= 1), then the sum of the Q-values for each [RPs_long], provided that the [Add] field is "Yes", will then be able to determine what are the final output RPs to be used, i.e. for the sum of the Q-values are greater or equal to 1 (>= 1), that [RPs_long] will be used.
I've been stuck on this for quite some time, and I know that if I change the whole table structure (like having a field for each RPs in the [tbl Ingred]), I might be able to make it much easier for myself. However, by doing so, it will not be able to offer as much flexibility in the calculations, and also, may not make it as 'user-friendly'. Another thought was maybe to create another table with just the [CompCodeID] (based on [tbl Ingred].[CompCode]), [Weight], [RP], but I'm not too sure how this will work either, but I might give it a shot if this current method doesn't work.
I hope that this made sense, as it is all quite complex (and confusing) to me. Any help on this matter will be much appreciated. Thanks in advance.
View 2 Replies
View Related
Apr 29, 2014
I have a field on a report that I was able to make bold using conditional formatting. I want to make the other fields in the row bold as well if the value of the 1st field equals a set value.
EX: Contractor Bid Amount Sq Footage =[bid amount]/[sq footage] =[bid amount]/[estimate]
I put conditional formatting on the Contractor field
EX: Field Value Is equal to "Estimations"
I was Bid Amount, Sq Footage, =[bid amount]/[sq footage] and =[bid amount]/[estimate] fields to also be bold if the Contractor field is equal to Estimations.
View 11 Replies
View Related
Oct 17, 2007
I have an interesting report query I am working on. Is it possible to have a query that shows different fields for individual records depending on the content of the record? Let me see if I can explain. Let's say that I have a Status field that can be "Complete", "Active", or "Planned". And lets say also in that table I have Field1, Field2, and Field3. For each record, I don't want to include all three fields (Field1, Field2, Field3), but only one of these fields depending on what is in the Status field.
So, it would be something like:
Select Status, (if Status = "Complete", select Field1), (if Status = "Planned", select Field2), (if Status = "Active", select field3) FROM table;
So, the query would result in 2 fields for each record: the status field, and one of the three other fields depending on what is in the status field for that record.
Thank you kindly for your help.
View 2 Replies
View Related
Feb 1, 2005
:D I am using a continuous form, and I cannot figure out what conditional formatting expression to use to change controls in the ACTIVE RECORD.
For example, continuous form may have:
RECORD1: Field 1 Field 2 Field 3 Field 4
RECORD2: Field 1 Field 2 Field 3 Field 4
RECORD3: Field 1 Field 2 Field 3 Field 4
When I am in Field 1,2,3, or 4 in RECORD2, I want Fields 1,2,3 AND 4 to change color in RECORD2
PLEASE HELP!
View 5 Replies
View Related
Jan 14, 2014
I have a field on a form OrderDate and a field DOB. I am not sure how to create an expression in conditional formatting that:
=IF([DOB] - [OrderDate] <30), Then background is red
So if the OrderDate is 1/1/2014 and the DOB is 1/15/2014 then the DOB field turns red
If the OrderDate is 1/1/2014 and the DOB is 2/29/2012 then the DOB field does not turn red.
View 8 Replies
View Related
Dec 11, 2012
I am struggling to format a field on a report.
I believe it is because special charachters are in the text string
I want to highlight the field if it contains the following text
Stage 6: Won and Deploy (shipping)
Regretably, I believe Access see this as code.
I suspect I need to encapsulate it some way, but nothing seems to be working
What am I missing?? How can I force Access to see it as a text string??
View 1 Replies
View Related
Feb 6, 2013
I have tried to change the colour of the text in time fields with no a value of 0:00 by using conditional formatting - to no avail.
View 4 Replies
View Related
Mar 26, 2015
In my Access 2010 report, I am attempting to perform conditional formatting of one field based on the difference between two fields. In particular, one field is "Time Scheduled" and the other field is "Time In". If the "Time In" is equal to or greater than 60 minutes of "Time Scheduled", I would like to format it to be red font. If it is less, I would like to format it to be green font.how I can conditionally format to do this?
View 12 Replies
View Related
Mar 20, 2014
I am trying to add conditional formatting to a several fields in a report. So far i can use the contional formatting to set a field called [colour] to set that field to red and bold. But i believe I need to use an Expression for all fields, so I can make all fields that = red go red. I have used the the expression:
[colour] = "red"
but nothing happens.
Expression Is [Subtotal]+[Freight] > 50
View 4 Replies
View Related
Apr 3, 2006
Hi
I have a form where data is entered and outcomes are entered. Any ideas how i can make the outcome field mandatory before someone moves on to the next record?
Thanks
Ben
View 4 Replies
View Related
May 4, 2006
I have Form where we have 4 text boxes and out of which atleast one should be checked before closing the form, if not selected user should get the prompt to do so via message box and once selected at least one box form should be able to be saved, they can select multiple text box values but none should be blan or also no body should be able to skip by pressing space bar either !
Can someone post the coding solution please.
View 1 Replies
View Related
Jul 5, 2014
What I am trying to do is create conditional formatting to colour fields within a form.
The conditional formatting option built in allows me to colour based on set values i.e. Value=Design turns green. I need to somehow say if Value contains the word Design turn green. This is because in addition to the word Design there will be a variable description. I tried editing the conditional format created by the wizard to Value="*Design*" but that didn't work.
Now I'm trying to write it in VBA code but am still struggling. Here's what I tried but it doesn't like it:
If InStr([Forms]![Query2]![Activity] Like "*Design")>0 Then
[Forms]![Query2]![Activity].BackColor = vbGreen
End If
View 14 Replies
View Related
Feb 17, 2015
So i have two fields I need to tie together for conditional formatting
If the "status" field says "RETURN" and its over "30" days then I need to highlight it RED
If the "status" field says "AVAILABLE" and its over "90" days then I need to highlight it RED
Is this possible?
View 5 Replies
View Related
Dec 15, 2006
hello,
I would like to force entry to a txtbox via code.
the txt is named txtssn and would like that if data is not entered a message will advice users to complete the entry and the mouse cursor should go back to that txtssn.
Is this possible? Thanks.
View 2 Replies
View Related
Sep 24, 2014
I have a report which I would like to apply conditional formatting on multiple fields. I would like the conditional formatting to be based on two types of criteria
First criteria would be contracts that start with the year 2014. I used the following expression which worked - InStr(1,[ContractNr],"2014" AND [DirectorInCharge]= "Joseph Steinbok" or "Adam Godson")
To this expression I would also like to highlight fields which contracts start with 2014 AND have a particular Director assigned to it. For this I used the following expression - And [DirectorInCharge]="Name"
On their own, both expressions are working but I want to combine them. How do I do this? I've tried the following - InStr(1,[ContractNr],"2014" AND [DirectorInCharge]= "Name") but then nothing is highlighted. I also tried InStr(1,[ContractNr],"2014") AND [DirectorInCharge]= "Name" - in this instance EVERY record was highlighted.
View 4 Replies
View Related
Nov 4, 2011
I have a form where I would like one of two fields mandatory to fill.I have an encryption password field and a pen drive password field. I would it so when the user tries to close the form, one of these two fields has to be filled in.
View 1 Replies
View Related