Two Problems With Mandatory Fields In Forms

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 Replies


ADVERTISEMENT

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 14 Replies View Related

Forms :: Creating Mandatory Fields In A Database?

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

Forms :: Update Database Column When Mandatory Fields Are Completed

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

Forms :: Highlight Mandatory Controls On A Form Tab

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

Forms :: Mandatory Entry Message If Field Blank

May 11, 2014

How to have a message appear if the "Symbol_Stock" field is blank.

View 14 Replies View Related

Mandatory Field

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

Mandatory Field

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

Mandatory Entry In Field

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

Making One Field Or Another Mandatory To Fill

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

Modules & VBA :: Mandatory Data Entry In Field Before Moving To Another Field

Aug 22, 2014

I have a form that users will use to add new records (customers).

There is a field named VAT_Registration_no

First of all i want some code to check for duplicates in that field only,before entering the next field.If the record exists i want to show a msgbox and set focus to the vat_registration_no field. Also I want the same thing to happen if the vat_registration_no field is empty.here is what i have tried:

Private Sub VAT_registration_no_AfterUpdate()
Dim btest As Boolean
If VAT_registration_no = "" Or IsNull(Me.VAT_registration_no) Then
MsgBox "Please enter a Vat Registration No.", vbOKOnly, "error"
Me.VAT_registration_no.SetFocus
Else
btest = True
End If
End Sub

and to all other fields:

Private Sub textfield_Enter()
If Not btest Then
Me.textfield.SetFocus
End If
End Sub

If I just press enter to go straight to the second field I dont get a msg. If I write something and delete it and press enter i get the msg but when I press ok the cursor goes to the next field. I want it to go to the vat_registration_no field again. And I also want this to happen even if dont write something and then delete it.

View 3 Replies View Related

Forms :: Adding Fields In A Table And Having Output Fill Fields On A Form

Jan 29, 2014

I have a totalquery that runs fine and give me the sum for both fields I'm looking for but I can't get the outputs to fill the fields on the form. I have tried the Dcount query in the control source but that just returns an error and locks up access.

Code:
SELECT [Tble-wcDelays].Causedby, Sum([Tble-wcDelays].HoursDelay) AS SumOfHoursDelay
FROM [Tble-wcDelays]
GROUP BY [Tble-wcDelays].Causedby, [Tble-wcDelays].LinkingID
HAVING ((([Tble-wcDelays].LinkingID)=[Forms]![Frm-ePlusCent]![cleanID]));

That is the query.

View 14 Replies View Related

Forms :: Total Query - Count Of Fields Based On Data In Other Fields

Jun 28, 2015

I have a query that creates counts of fields based on the data in other fields, basically it tells me that in a table there are two entries with value ABC????? and three of DEF????? , the query works perfectly.

When I create a form to display this data and base the form on the Query I keep getting a message box asking for the ID (key field) from the base table.

If I type * in the box (to denote all values) and press enter I get the results expected.

View 4 Replies View Related

Forms :: Copy Specific Fields From Selected Record To Specific Fields In Subform?

Jul 9, 2015

I am new to access i have a problem which is i have made a form which contains a subform and a read only subreport, what i want is the ability to select a record in read only subreport as in the picture attached and make a button that when i press on it, it should copy the values of the itemsID field, Packing field, ContainerNo field and origin field from the selected record and then paste them in the subform below.

Also i want to add more then one item, so the when i press on another record it should paste the values below the first record.

View 12 Replies View Related

Forms :: Continuous Forms - Looping Through Records / Manipulating Fields On Form

May 29, 2015

I have a bound continuous tabular form,However, based on data content in one field of a record, I want a checkbox in the same record enabled, so the user can check it if necessary. I have created a record set using the form as shown below, and I am looping through each record. To show that my code is referring to the field with required data content, I display it as a message box and it works, yet my checkbox does not enable.

I have the code in the form_load event, however, for testing purposes I have it behind a button.If I am seeing this properly, the code behind the button enables the checkbox for ALL records once the criteria in the required field is true, and based on the last record, which has no data content, it disables the checkbox in ALL records. I also have the PK ID for each record hidden in the form. Can I utilize that to target the checkbox of each individual record??

Form Detail
-Form does not allow additions or deletions. Edits allowed
-All fields are disabled and locked
-I only want the check box to unlock if data is found in the "RequiredField" as referred to below. I have also tried if not isNull(requiredfield.value) then -enable checkbox, which yields the same results

Here is my code

Code:

Dim rstMyForm As DAO.Recordset
Set rstMyForm = Forms!MyForm.Form.Recordset
rstMyForm.MoveFirst
Do While Not rstMyForm.EOF
If Not RequiredField.Value = "" Then

[code]...

View 14 Replies View Related

Forms :: Calculated Fields In Continuous Forms

Aug 14, 2015

i have a continues form that lists all my active items and I'd like to use it to quickly check if they have all the data inserted, ie entries in each separate table. it looks like this

I perform a simple check on form load chk = DCount("[phID]", "preh", "[phbID] = " & Me.tID) where me.tid is the item ID and this gives me 0 or 1 and writes ok, or missing into the appropriate box.Problem is it tkaes value for the first item and repeats it for eah other, so I get ok or missing throughout the continuos form.How can i force a check for each line?

View 1 Replies View Related

Forms :: Locking Fields In Forms?

Oct 30, 2013

locking entry of data in a form. Attached is the database in which my question lies.

The user first interacts with Table 1, which then leads to the opening of the Personal form (as per the user's wishes). What I would like to do is:

1: To give the user the authority to enter data in those cases where the fields in the Personal form is empty (in the case of the Names). The user should not be able to change any data if these fields are not empty.

2: To give the user the ability to change the Amount (If this figure is Zero) and not to change anything if this amount is not Zero.

View 4 Replies View Related

Hello, .... And Help Please With Forms And Fields

Aug 29, 2006

Hi All,

I'm new here as I have only just started to use access :rolleyes:

I am just creating a very small and simple database (one table, five fields) for personal use.

My question is this:

I have a text field called [rank] which is a list of predefined texts eg "level1", "Level2" etc etc up to "Level9".

I have a form created to edit all the fields (which works fine) however I have created a button which I would like to do the following but don't know how to set it up :confused: .

When the button is pressed I want to automatically 'promote' the above field. ie if it is at "Level9" it changes it to "level8", or if its at "level2" it changes it to "level1" for all the different levels (if its at "level1" it shouldn't do anything)

Thanks in advance for your help :)

View 5 Replies View Related

Lookup Fields In Forms......

Feb 12, 2005

I am working on a project that I know I am making more difficult then it need be...... Maybe because I started with a form and tried to build everything else around it. The database looked bad...... Now it looks good... normalized as I can see it... But trying to get the information in is being difficult.
The DB has customers, thats no problem. These customers have inspections done to areas for cleaning.
I have done the areas in a drop down, in one table, and the task to be rated as a dropdown in another table. Then finally a rating table....1 to 5.
It is very easy to go in in datasheet view and input the info for each area, then pick a task from the next dropdown and then pick a rating from the final.
Problem is this won't be as easy for someone else to input. So here is the form problem.
Heres how I would like to lay it out. An over all inspection form. Areas inspected and rating (average)
I will use a command button from the main form to open up say "area1"
On the area one form is the first problem....
I want 6 different task to give a rating to...... But these task are on a dropdown....so I can not bring over the field more then once.... or I dont know how..It's getting confusing and I don't think it should be.... its a pretty simple one.
So can anyone guild me to a databse similiar to this? I need to see how one like this is done.

Thanks

View 1 Replies View Related

Blank Fields In Forms

Oct 26, 2005

I am setting up a form with a few tables in it.

I want each table to relate to the form.

When the Next button at the bottom of the page is clicked I want all the values of each table recorded even if there were no values put in the boxes.

For example if there is no value added to the field boxes in say half the tables I want the default value to be recorded as blank or zero so that each table has the same Autonumber associated with the other tables in the form.

What is the best way to do this?

s

View 5 Replies View Related

Enabling Fields In Forms

Nov 8, 2005

I want a form to default open in read only mode to avoid users deleting info. I want them to be able to edit the form by pressing a button. Does anyone know the VB code to run from a command button to do this.

Regards :confused:

View 6 Replies View Related

Calculated Fields In Forms?

Sep 9, 2006

Now I can create a Query that adds, subtracts a specific column, but im having a hard time trying to get the information into a form since it don't seem to allow me to pick the query field which is calculated as a datasource. Can someone tell me how to make a calculated query column appear on a form as a field? Such if I type in monday in the regular table, the form will add a few days to the next available game? I have the information/code already in a query that displays the query right in a new table using the Expr method but I can't get the form to just simply display the field. Someone please help!

I see a few people asked close to the same question but nobody never answered so I am thinking it is impossible

View 3 Replies View Related

Linking Fields In Forms

Nov 21, 2003

My question is this:
I have a form called Family with a RecID field. When I create a new record on this form the RecID field auto assigns a #. Then the user is supposed to click the command button which brings them to another form called Child. This Child form has the RecID field and another called RecChildID.
The RecID field is linked to the same RecID field as form the previous form. But when I enter the child form and start it's linked record the RecID field is not filling in/ copying over the same # as the previous form. How can I get it to update the RecID from the first form to the second form?
Thanks!

View 14 Replies View Related

Forms, Updating Fields

Jun 22, 2007

Hello,

I have a form where there are four fields that the user selects via a drop down combo box: account number, Group, Name and Date. The entire form is linked to a table named 'Questionaire', but all of the drop down selections are sourced throw other tables and queries. At the end of the day, all of the information flows to the 'Questionaire' table, which is the DB's main table. Subsequently, there is also a subform as part of this form, but that is beyond the question here.

What I am trying to do is change my Group field to be something that automatically populated by the database and not something that the user needs to identify. For instance, when the user begins to enter his or her information into the DB, they input their name, date, and account number....once the account number is entered, i would like to have the group automatically generate and NOT be something they must choose.

The possible account number selections are driven from a different table named 'Accounts', and in this table are the fields: Decription, Group, and so forth.

What do I need to code or build in order to have the 'Group' ID automatically update when the 'Account' number is entered?


Thanks for your assistance with this.

View 3 Replies View Related

Forms :: Autopopulate For One Of 8 Fields Only?

Mar 18, 2013

I have a Subform/Subreport that shows in a datasheet view. I hosts two (2) fields on it: "Job Performed" & "Details". The "Job Performed" field is a drop-down list. The "Details" field is a memo field.

What I am trying to do is, well, one of the selections in the drop-down list will ALWAYS have the same details - "Changed Oil & Filter". But all of the rest will vary constantly.

So my question is, can I make it so if "Monthly" is selected from the first (drop-down) field, it will ALWAYS populate the Details field with the words "Changed Oil & Filter" without affecting the other selections?

View 1 Replies View Related

Forms :: Sum Of Time Fields

Mar 13, 2014

I have a form generated from infopath where users enter the amount of time it took them to complete a task. It is set up right now in time format, so a user would enter Task A-0:15 (to show 15 minutes). Users have multiple tasks with different times and I would like to be able to show a total for all those tasks combined.

Task A-0:15
Task B-0:45
Task C-1:30
Task D-0:30
Total = 3:00 <------This is what I would like to do

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved