Validating A Field In Access

Oct 27, 2004

I have two tables in an Access Database- One is the chart of accounts, and the other is the actual entries, with the common field being ID. Chart of accounts is set up something like this-

ID Description
1000 Customer Revenue
2000 Office Expenses
2100 Paper

That kind of thing. Anyway, I want to set up the ID field in the entries table so that it is basically a pull down box that only allows you to enter one of the IDs listed in the Chart of Accounts. Any way to do this? I'd really hate to have to write a quick separate program to do this.

View Replies


ADVERTISEMENT

Forms :: Validating Text Field On Form Against Another Field In Same Record?

Apr 17, 2014

I have a form where I would like to validate (restrict) choices in subsequent fields.

Example

Combobox choices are Air, Fire, Water, Earth, Space

In the form I have 4 fields = Material1, Material2, Material3, Material4. (all in same record on my table)

Basically I need the validation to not allow duplicates across the 4 fields.

something like....

[Material1] <> [Material2] or [Material3]or [Material4]

I am not sure of the proper syntax for the validation field in the Form Properties. Or if I am even putting it in the right place.

View 3 Replies View Related

Tables :: Validating A Field Using Another Checkbox Field

Apr 17, 2013

i have a database am working on in access 2010. I want a field to take its value based on another field's combo.Example;i have a checkbox field called "Loan" "Yes/No" and i have another textbox filed "Status" (which will hold eligibility). I want the Status to read Eligible when the checkbox is No and Non-eligible when its Yes

View 3 Replies View Related

Validating A Field (dependent Fields)

May 28, 2005

I am trying to put in a validation rule so that data in one field cannot be less than that in another.
e.g. i want to make a validation rule so that a phone call end time cannot be before the phone call start time.
Can anyone help???

View 5 Replies View Related

Comparing DB Entries Within A Field And Validating Them

Sep 25, 2005

Hi,

This may be a little difficult to explain but here goes:

I have a table in access 97 with the field Account. An account name is usually written as 0000000_A, but it MAY also have a secondary account and is usually written with the same first series of digits but ends in B e.g. 0000000_B. Therefore, we could have an account 0023654_A and 0023654_B.

Now for each account name there is another field called Items which are chosen from a combo box on a form (item 1, item 2, item 3, item 4, item 5, item 6, item 7 and item 8). An account may have more than one item.

Now if account B exists then it MUST contain the same entries as account A but can also have additional items.
So we could have a situation where:

0023654_A
item 1
item 2
item 3
item 4

0023654_B
item 1
item 2
item 3
item 4
item 5
item 6

Now what I am trying to implement is that if the core items (these are those that are contained in both - which would be item 1, item 2, item 3 and item 4 in the above example) are changed in either accounts making them not equal then a warning message should come up stating so. IT IS IMPERATIVE THAT THE CORE ITEMS ARE PRESENT IN BOTH.

I have some experience in Access 97, but unsure of how to tackle this. Could somebody please guide me ???

View 1 Replies View Related

How To Stop A Form From Closing After Validating A Field

Jun 12, 2006

Hi,
I've got a close button on my form as follows:
Private Sub exitForm_Click()
DoCmd.Close
End Sub

In the beforeupdate event of the form I have have following code to validate the forms fields:

Private Sub Form_BeforeUpdate(Cancel As Integer)
'Place an asterisk (*) in the Tag Property of the text boxes you wish to validate.
'Then in the BeforeUpdate Event of the form, copy/paste the following:


Dim msg As String, Style As Integer, Title As String
Dim nl As String, ctl As Control


nl = vbNewLine & vbNewLine

For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
If ctl.Tag = "*" And Trim(ctl & "") = "" Then
msg = "Data Required for '" & ctl.Name & "' field!" & nl & _
"You can't save this record until this data is provided!" & nl & _
"Enter the data and try again . . . "
Style = vbCritical + vbOKOnly
Title = "Required Data..."
MsgBox msg, Style, Title
ctl.SetFocus
Cancel = True
Exit For
End If
End If
Next
End Sub

This validation works fine up to a point. If I try to close the form and a required field is empty, I get a message box asking me to fill in the data. The problem is that when I click ok to the message, it shuts down the form, so I have to re-enter all the data again. My question is how do I prevent the form from closing after clicking ok on the message box?

appreciate your help:)

View 1 Replies View Related

Tables :: Validating Field - If Number Exist In Another Table?

May 1, 2013

Validating field from a query. I have a table with a field that has a value number that I need to validate that that number exist in another table in a field

Table1.field1 Number
Table2.field1 number

So let's say a have in table2.field1 the list 1 2 3 4 5 8

In table1.field1 I need to validate that the number I enter is present in table2.field1 so 1 would be ok but 6 invalid and it can't be a from list statement because I need the person to enter a number and get no error or get invalid number.

View 2 Replies View Related

Validating

May 3, 2006

I have a form that creates quotes for my company by inputting inventory items in a continuous subform. I need to be able to check and see if the item already exists in the inventory or if it is a new one that has been manually entered, and have this toggle a bound yes/no field that I will use to control whether or not some fields on the form are locked. Here is the code I have been using, but it doesn't seem to work at all.

Private Sub Combo14_AfterUpdate()
Dim itemcheck As Integer
itemcheck = DCount("[Item]", "tbItems", "[Item] = " & Chr(34) & Me![Item] & Chr(34))
If itemcheck = "0" Then
Me![Locked] = False
Else
Me![Locked] = True
End If
End Sub

I would appreciate anyone's feedback on this.

View 2 Replies View Related

Validating Records

Jul 19, 2007

All I really need some help.

I have two tables:

Table 1
Table 2

There is a one to many relationship here.

One in table 1 and many in table 2.

When I add in a record in table 1, I need a validation script/key that won't allow adding a record to table 1 without a corresponding record in table two.

Please help. I'm really stuck. I am doing this through a form. I tried messing around with the "requirements" but had no luck.

View 5 Replies View Related

Validating A Surname

Apr 2, 2008

I need to validate a surname field which obviously can only consist of letters and occasionally spaces and/or hyphens. (i.e. van Driel or Johnson-Crooks)I managed to create a validation rule which would allow me to have space in the surname field:Is Null Or Not Like "*[!((a-z) or ( ))]*"but when I tried to allow hyphens into the field - I used these codes - but none of them worked:Is Null Or Not Like "*[!((a-z) or ( ) or (-))]*"Is Null Or Not Like "*[!(a-z)]*" Or Not Like (" ") Or Not Like ("-")Is Null Or Not Like "*[!(a-z)]*" Or Not Like "*[!( )]*" Or Not Like "*[!(-)]*"Is Null Or Not Like "*[!(a-z)]*" Or Like "*[!( )]*" Or Like "*[!(-)]*"Is Null Or Not Like "*[!(a-z)]*" Or Not Like "*[( )]*" Or Not Like "*[(-)]*"Is Null or Not Like "*[!(a-z)]*" or (in ("-"," "))Is Null Or Not Like "*[!(a-z)]*" And (Not In ("*[0-9]*"))Is Null Or Not Like "*[!(a-z)]*" And (Not In ("*[0-9]*")) And (In ("-"," "))Is Null Or Not Like "*[!(a-z)]*" Or Like ( ) Or (-)Please can smeone help me.James

View 3 Replies View Related

Validating Against Another Table

Nov 15, 2006

Hello all.

I'm having a problem with a query. I am pulling information from a table that holds demographic info plus some company info. the data in question is the deptno of an employee. This employee also has a jobcode associated with it. I have another table with a list of a few jobcodes.

The data I will retrieve is fname, lname and deptno. If a person is in detno 210 then I want to check his jobcode in the jobcode table. If it is in the table then I want it to return 215 for a deptno. If not then it will return 210.

Does anyone know how this query would look like?

Thanks in advance.

View 1 Replies View Related

Validating Data

May 10, 2005

I have taken over a database that has be modified by a number of people over time. I have a forw with tab controls and a some of the fields are critical to be completed before you should be able to progress to the next tab. There are currently validation controls on the controls on the first tab, but if you only complete the first of these controls it is possible to move on to the second tab. The third tab is a subform and and if you try and select this tab, the validation text appears, but you can still switch to that tab which I want to prevent.

Finally, I have deleted one of the controls which was a critical field for completeion. I had assumed the validation was based on the validation on the control and would therefore be deleted but I still get a message saying complete this. I can't work out where there miight be code to make this happen? I'm not sure if anyone can help me with this without seeing the database, but I just wondered if anyone had any ideas what to even look for to help me understand this.

Sorry if all this is a bit vague, but would really grateful if anyone can help me at all.

View 1 Replies View Related

Validating A Dropdown

Oct 25, 2005

Question I am looking at some annoying Access database for a charity and got stuck on trying to make something work that they believe used to

Two Tables

Venues
pK Venue ID
Venue Name
Venue Capacity

Booking
pK
Venue
Name
Addr1
Addr2
Addr3
Ect

They have a query call capacity check which does the following
Count Occurrences of Venues then takes this away from venue capacity

Essentially they have a standard access form of the Booking table with a drop down box and want it to only validate if seats are still free at a venue eg if the current count for venue is less than the venue capacity.

Any ideas ?

View 2 Replies View Related

Validating A Form Using VBA

Mar 23, 2006

Hi all

Im currently trying to set validation rules for a form using VBA, does anyone know of a good method of doing this as i'm a bit stuck:confused:

View 1 Replies View Related

Validating New Records

May 4, 2006

I have a NEW INVOICE button, and the code behind says
DoCmd.GoToRecord , , acNewRec

Now if a user clicks on this buttons 3 times, three blank records get inserted in the table. THis is because I am generating teh invoice number myself, and the invoice_date is defaulted to current date (DATE())

The script written in the Sub Form_BeforeUpdate event to validate if the invoice is empty, if the total is ZERO etc. is all skipped, and I get blank records in the table. I even tried to place breakpoints in the before updates script, but it does not even come inside.

What is the right way to trap data errors, blank records in this situation?

Please help.

Thanks,
Vinai

View 3 Replies View Related

Validating An I.P. Entry

Jul 26, 2006

Hey,

I've been looking at this website (http://learning.north.londonmet.ac.uk/ib212/week7/validation.htm) and i'm trying to find an input mask that lets a user enter in an I.P. address like the IP settings in Network Connection > Properties > TCP/IP > Properties.

E.g. a user enters 19216802. I want this converted to 192.168.0.2 without the user having to enter any '.'

So far this is the closest i've gotten to validating the field
0##.0##.0##.0## whereas 0 means something has to be entered and the # are optional.

Thanks,

Barret

View 3 Replies View Related

Validating IP Entries

Jul 28, 2006

Hey,

In a form I am trying to complete, I want the user to be able to enter in an IP address like so

192168<user hits space bar>0<user hits space bar>1

Would convert to - 192.168.0.1

Is there an input mask which allows this to happen?

Thanks.

View 2 Replies View Related

Validating A Post Code

Nov 29, 2006

HiBeen trying To Find A Way Of Validating A Postcode.But Getting No Where Being They Can Be Like CT1 1QX, CT11 2DT, CT11 12DT Act.Best I've done is to make sure there's a space and it starts and ends with a Letter.Any Help Advice Would be much AppreciatedMick

View 2 Replies View Related

Validating Dates In Tables

Jun 20, 2007

Hi there, just a quick question really.
I have got a start date and an end date field in a table both in Date/Time data type. Can i validate the end date so that it cannot be longer than 5 days after the start date, that has been entered. Or is this impossible to do in a table?

Thanks for any help

View 10 Replies View Related

Validating Email Addresses

Mar 25, 2008

Hi
I have a large file where I am trying to clean up the data.
One of the fields is the email address.
I want to check if the email address has something followed by an @ symbol followed by something else. If it does not, then I want to replace it with a null value.
Can you help?
I thought that I could use the wildcard features such as <>*@* but this does not appear to be working.
Noel

View 6 Replies View Related

Validating Phone Numbers

Mar 25, 2008

Hi
I am trying to work with a large table of customer data.
I know that there is a large number of invalid values.
I would like to run a make table query that would check the phone number against a table of known invalid numbers (e.g. 1234567, 11111111, 99999999, etc).
If the number exists on the invalid table, then I would like to replace it with a null value.
Regards
Noel

View 1 Replies View Related

Validating Data On Exit

Sep 10, 2006

I'm trying to figure out how to validate a field to make sure the users are not entering any blank spaces into the field. I've tried setting the mask up as "aaaaaa" but it still lets the user enter a blank space.

I've also tried building an event procedure to run on exit that reads:

Private Sub Barcode_Exit(Cancel As Integer)
Dim LPos As Integer
Dim LChar As String
Dim LValid_Values As String

'Start at first character in Barcode
LPos = 1

'Set up values that are considered to be alphanumeric
LValid_Values = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWX YZ+-.0123456789"

'Test each character in Barcode
While LPos <= Len(pValue)

'Single character in Barcode
LChar = Mid(pValue, LPos, 1)

'If character is not alphanumeric, return FALSE
If InStr(LValid_Values, LChar) = 0 Then
AlphaNumeric = False
Exit Function
End If

'Increment counter
LPos = LPos + 1

Wend

'Value is alphanumeric, return TRUE
AlphaNumeric = True
If AlphaNumberic = False Then
MsgBox "Barcode cannot contain blank spaces, only letters and numbers.", vbExclamation, "Barcode Field Value"
Else
End Sub

****
However the message box does not come up and the form will not then let you get out of that field.

Any ideas? I've been checking on this field by running a query and then manually correcting the errors but I would rather that the DB check and force correction at the time the data is entered.

Any and all help will be greatly appreciated.

Charis

View 5 Replies View Related

Validating Dates On Forms

Mar 12, 2005

Here is the code I have in a module. When I put the correct dates in, the message box appears telling me that the date is incorrect, but I have checked and the closing date appears to be later that the date for completion.

When I accept the error message I get a runtime error 2115 saying that the database engine is being prevented form saving the data to the table.

Can anyone offer some help as to my problem here?

The code:

Private Sub txtbx_Date_Closed_BeforeUpdate(Cancel As Integer)

'Declaring the variables
Dim Completed As String
Dim Closed As String

'Assigning values to the variables
Completed = "txtbx_Date_Completed"
Closed = "txtbx_Date Closed"

'Checking to see if there is no completed date
If IsNull(Completed) Then
MsgBox "The action must be completed prior to being closed"
Me![txtbx_Date_Closed] = Null
Exit Sub
'Validating the closing date
ElseIf Closed < Completed Then
MsgBox "The closing date cannot be before completion date"
Me![txtbx_Date Closed] = Null
Exit Sub
End If

End Sub

View 3 Replies View Related

Validating Numeric Values!

Oct 15, 2006

How can I check if the user is entering numeric values?

I can do it in the code, i.e. the lost focus event to the text box but I want to make a check in the "validation rule property" of the text box...!! How is it possible??

Thanks

View 1 Replies View Related

Validating Decimal Values!!

Oct 16, 2006

How do I validate if the inputted value by the user is a decimal value or not?

Also I need that before the decimal only 3 digits should be inputted.

View 1 Replies View Related

General :: Validating Two Fields Against Each Other?

Oct 9, 2013

I am trying to validate two fields in a form against each other. Neither are required, but If one is filled in, then the other must be filled in. If neither is filled in then they can both be blank. It is for a time, and description related to that time.

So if they enter in 5 hours, they have to type in the description field describing those 5 hours. If they type in the description field, they have to type in the hours. Vice versa. Or they can both be blank.

Right now I put in the table properties validation rule

([Other Description In] Is Null) Or ([Other Time In]>0)

This works half way. It stops them from putting in a description without time. but they can still put time without a description.

I can't figure out how to do multiple validations of the same two fields. If I do an And or another Or statement it breaks the whole thing and they can enter with no restrictions.

Also, I tired to do it at form level for the other half (to stop them from putting time without a description) but it brings up a pop up and they cant tab to the description field to enter a description without putting time back to "0" first.

View 5 Replies View Related







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