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:
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 ???
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.
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
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???
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?
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.
Hi, I just started doing something in access and need your help. I have created a database and need to create a query which will sort all important fields within a certain time period. I have a date field and in the criteria field I wrote an expression:">Forms![Insert_date_form]![starting_date_field] and < Forms![insert_date_form]![ending_date_field]"
Its purpose is to show all fields which date is between this to dates. User will have to enter this dates in a separate form(Insert_date_form) which will store it in a small database containing only these two fields, e.g. generate report of all employees that are started working within a period between starting_date and a ending date. When I try to create and open a report based on this query I've been prompted with a small dialog which says: Enter parameter value.... for starting_date_field and same for ending_date_field. I don't need that. These dates are allready entered by user in a insert_date form and stored in its databese.
Is there a beter way to do this?
Thanks! P.S. Sorry for my poor english. It's not my native language.
I have a table [VL] with four fields, [vl_id], [product], [vl_date], [valeur_liquidative].
The idea of the table is that you can input and update the value of each product on a given day.
I need to find the difference in days between successive dates (vl_date) each time that a product value (valeur_liquidative) is updated. Values aren't updated everyday as it is not updated during the weekends. I have had a go at this but have struggled..
A picture of what the table looks like is attached for reference.
I have a table that has a date field set to text. I use the Mid function and get just the month in a query. I have a textbox on a form that when the user adds a month or removes a month from a selected listbox it adds or removes that months number from the textbox.
I want to us that text box on the form as the criteria for the month (the Mid function getting the month) and I can seem to get it to read what's in the textbox and use it as the criteria. I can manually type in a number and it works fine.
I want to make a query that results in displaying records that have the same IP-address where the difference in the date/time stamp is within 1 minute. When the date/time stamp is > 1 minute the record can be deleted from the table.
I have a table to store "issues" with fields Issue name(text), target date(date) and status (combo box-active & pending statuses). default status for new issue is active. when clicking a button i want to change the status of every record to "pending" status (combo box value should be pending) if the target date<current date.
I have about 36 names and each of those names appears anywhere from 2 7 times each. Each name entry has a comment1 and a comment2.What I would like to do is create a form that allows me to choosea name and the display the comments 1 and comments 2 in text boxes.
I have made the form to allow me to choose a name and it shows one of the comment1 and one of teh comment2 in the adjacent text boxes as planned but, I want all the comment1s for Bob to show in the text box for comment1 and all of the comment2s for Bob to show in the Comment2 text box.I believe I need to concatenate the results in the comment1 and comment2 boxes, but I do not know where or how I would do that.
I'm new to Access and databases so my question might seem dumb, but I need some help figuring something out. Well, I have this database where I'm storing information from different charities. So I created a table with their name, address, phone, contact person, and many othe things. Now I need to create a field with the services that they offer. Each charity could be able to offer more than one type of service. So for the services field, I cannot create a drop down list because that only allows me to choose one service. So what would be the best way to allow the user select more than one kind of service offered from a list and then be able to search that with a query? I have a list with over 50 different possible offered services and each charity usually offers 2 or 3 different services.Thanks
I would like to know if there's any way of fitting multiple entires of data into one field in a table. For example, a field for addresses that might be able to hold two or more different addresses. Must I create another column/field to hold how many different addresses that that person might have? Thanks!
I have a table that contains doctor information including their license number. This came from a worksheet that tracked referrals from last season. I need a query that will show me only those record that have a unique MD License number. In other words I only need to see the 5-600 doctors out of the 2420 referrals in the table. Once I get the query of unique MD's I can create a report for the salesmen to use to contact them for the upcoming year. I know this is probably simple but I can't find the solution. Thanks in advance.
A user enters text into a memo field for an existing client, then it's closed, the same record reopened and more entered into the memo.The problem is when it's reopened the existing text is hi-lighted, and it's really easy for someone to begin typing and write over it.I want to reopen it, create a new line, enter a date stamp maybe, create another line with the cursor in it, ready for the user to enter new text.
Let's say if I am building a database for a library and in a table the book titles are the primary key and there is a field "authors" to record the authors' names.
But sometimes a book may have several writers and if I type all of them into one field, Access only recognise as one person. So how can I format/set up so that when I use query or filter, each one of names can be identified?
If multiple entries are not feasible, how else should I design my tables?
I'm pretty new to Access, so please overlook any stupid questions :) I have a data entry form that has one field that cannot be a duplicate. So, in the table I have it Indexed with No duplicates. The problem is that the form doesn't notify the user that they have entered duplicate information until they close the form. So the 10 minutes they spent filling it out is wasted. So, after consulting various posts, I did a BeforeUpdate event with the following code: (the field that must be unique is called "LS Number", in the form "Q and D" based on the table "Q and D Database")
Private Sub LS_Number_BeforeUpdate(Cancel As Integer) On Error GoTo LS_Number_BeforeUpdate_Err
If (DLookup("[LS Number]", "Q and D Database", "[LS Number]=Forms![Q and D]![LS Number]")) Then MsgBox "The LS Number you entered already exists. Enter a unique LS Number", vbInformation, "Duplicate LS Number"
When I test this by entering a duplicate LS Number, it gives me the error "Type Mismatch." Unfortunately, I have no idea what this means, nor do I know how to fix it.
Basically, I'm compiling a table of funding sources and whilst all the fields are relatively straight forward, how best to approach the matter of where the funding is available. For example, Funding A is available in America only, Funding B is available in America, Canada and Europe and Funding C is available Internationally etc (a huge number of possible options and infinite different combinations). How's best for me to lay this out because there will be hundreds of funding sources all with different availability criteria? If the field name is 'Countries funding is available', can a data type input be multiple entries?
Ultimately I'll want to be able to query show all funding sources available internationally or show those available to America and Canada only etc...and when I query on another field or show all, I'll want to see where each of the funding sources are available, listed out .
I have a simple table named [Groups] containing a Primary key ID, a Group name, a Group Leaders name and a date field. The date field merely lists the date of a particular Group related occurrence.
I need to know how many records have dates entered and assumed a simple total would achieve this. The Total is correctly shown in the appropriate row but most, but not all, of the date records are converted to show the same 'total' number.eg the date 28/01/2014 is changed to !4. Quite a weird occurrence.
Is it the case that date records cannot be totaled, in which case, why not all?
I have a table in access which is updated weekly; I need to create two tables from this updated table.
1st table will consist of all the new entries for the current week
2nd table will consist of all the entries from the previous week - an amalgamation of all the entries which are not from the "current week" (table) For example; the table below shows the two entries from last week.
ID Name
1 Adam
2 Ben
This week I have three new entries New entries
ID Name
3 Charles
4 Richard
So when I run the same query next week I will get something like this.
Old Entries ID Name
1 Adam
2 Ben
3 Charles
4 Richard
[code]....
How do I get a query /queries which divides up the weeks new entries and also all the old entries.
What is the best solution to this problem? How can I automatically assign a numerical value to a field based on the information currently contained as test in another field? For example, if I have a field that ranks a film as “Poor, Fair, Good, Great, Superior”, how can I have a set value appear for statistical purposes that assigns a number to each of these values (Something like: If rating of current record = “Poor”, then ranking = “1”; If rating of current record = “Fair”, then ranking = “2”; If rating of current record = “good”, then ranking = “3”, etc. I also want to be able to have the values recalculate if someone changes their original opinion.