Checking Field For A Value

Jan 17, 2006

I've had a search in the threaqds for an answer but cannot find anything specific, plus this one has stumped me.

What I need to do is check if a certain field has a value if another field has a specific value ??!!?

Ok so if Combo Box 1 is set to 1, then Combo box 2 must have a value selected.
If ComboBox 1 is set to 2, then Combo Box 3 must have a value.

for any other value for ComboBox 1 box 2 & 3 do not require a value.

If either of these statements are not correct then a message box should come up

Any help would be greatly appreciated

MattP

View Replies


ADVERTISEMENT

Checking A # Field

Sep 4, 2006

Hi guys, a company in my city is giving out prizes, and for each buy you get a sheet with 25 numbers ( kind of bingo thing). Well I have like 300 sheets . So i did an Access where I enter the SheetID and the 25 numbers. Now I have to do another table where I can insert the number that will be draw and whenever one of the sheet is complete, it let me know that I win!!! and the SheetID.
Any ideas!!! please please

View 1 Replies View Related

Set A Value In A Field By Checking A Box

May 13, 2005

Hi,
i want to set values (=numbers) in fields of a table by selecting check-boxes in a form (based on the same table).
as checkbox1 =1
checkbox2= 2
etc
If the box is checked the value should be entered, if unchecked the value should be removed.
Afterwards i want to show the sum of these values in another field in the same form.
I suppose this requires VBA. Could anybody help me plz ?

Thx

View 3 Replies View Related

Checking Empty Field

Jan 22, 2007

Im trying to check if a field is empty (i.e hasnt got anything in it)- but how do i do this. Ive called the field in my sql statement and then Ive put it in a variable- i,
I am then running a if statement

Code:If i = "" theni = "1" ElseEnd If

But this is not working?????

View 4 Replies View Related

Checking For Strings In A Field

Feb 16, 2008

Hi
I am trying to read a large file and to check if the phone number field is valid.
If there are more than 6 "1"s, "9"s or "0"s in the field, then I want to replace it with a null otherwise, I will treat it as a valid number.
Can you help?
Noel

View 7 Replies View Related

Error Checking And Multi Field Searching

Sep 17, 2007

Morning all,

Quick question... I figured out how to make all the searching items work... individually. The problem is is that I want to be able to search with two fields at a time. For example, say i have mo, date, job, pay and i want to seach for the MO and JOB and query the results accordingly. I can't get it to do that. Would I have to make a large If statement? I'm not entirely sure. Also now my problem is that it won't execute my first if statement or I should say it ignores it all togeather. I know it executes the code in the order it is written. If someone could shed some light I would be much apprecative. As always here is the code and attached is the program. What I'm working on is in the query table.

I also would like to be able for it to say if the fields MO and JOB do not comeup witha result for a messege to display there is no result. Or if the field is null not to do anything. I tried doing that in some of my code to no success perhaps I did somthing wrong.

Have a great day!


Dim strSQL As String
Dim sqlStringWHERE As String
Dim strhead As String
Dim strJOIN As String

' strSQL = "SELECT * from Panel WHERE MO like " & Chr$(39) & "*" & Me.qMO & "*" & Chr$(39)
strJOIN = " AND "
strhead = "SELECT * from Panel "

If Len(Me.qMO & vbNullString) Then
sqlStringWHERE = "WHERE [MO] like " & Chr$(39) & "*" & Me.qMO & "*" & Chr$(39)
Else
sqlStringWHERE = "WHERE [MO] = " & Chr$(39) & Me.qMO & Chr$(39)

sqlStringWHERE = sqlStringWHERE & strJOIN

End If

If Len(Me.qCode & vbNullString) Then
If Len(sqlStringWHERE) = 0 Then
sqlStringWHERE = "WHERE "
End If

sqlStringWHERE = "WHERE [CODE] like " & Chr$(39) & "*" & Me.qCode & "*" & Chr$(39)
Else
sqlStringWHERE = "WHERE [CODE] = " & Chr$(39) & Me.qCode & Chr$(39)

sqlStringWHERE = sqlStringWHERE & strJOIN
End If


strSQL = strhead & sqlStringWHERE

View 7 Replies View Related

Modules & VBA :: Checking Null Values In A Field

Jul 10, 2014

The following code doesn't check null condition in Scannedby field. The scannedby has text data type. The code gives me all the data where scandate=20130722 but doesn't check that scanned by can't be blank.

Code:
rs.Open "select count(*) from BatchTBL2 where scandate=20130722 and scannedby <> null", cn, adOpenKeyset, adLockOptimistic
j = rs.fields(0).Value

View 5 Replies View Related

Queries :: Checking Format (Identity Of Field)

May 28, 2013

I've got a database with an 'address 1' field. Sometimes if it's just a number, excel formats the field as a date. Is there anything to check the field to identify any that are showing as dates as opposed to just normal fields. For example identify all customers who have some variation of dd-mm-yyyy in the address-1 field.

View 10 Replies View Related

Modules & VBA :: Checking If Data Entered In Form Field Exist

Jan 17, 2015

I want to check if data entered in a form field is existed

The form is bounded to a table

I used this code

If DLookup("Telegram_Number", "tbl_Violation_Of_Building", "Telegram_Number Like " & Forms!frm_Add_Violation_Building!Telegram_Number) Then
MsgBox ("number existed")
Me.Telegram_Number = ""
Else
End If

everything is ok but if the data is existed the database show the message and clear the field but i'm getting a Run-time error

'-2147352567(80020009)': the macro or function set to the beforeupdate or validationRule property for this field is preventing [ISF] from saving the data in the field

I guess the problem because the form is bounded to a table so he will save automatically

My solution is to unbound the fields and save the data via vba but is there any solution with a bounded form???

View 3 Replies View Related

Modules & VBA :: Checking Checkbox (from Multiple Checkboxes) Based On Field Value

Nov 29, 2013

I have a field 'Payment Types' with values (Cash, Cheque, Debit/Credit Card) and a field 'Payment Received' which is Yes/No.

When putting the order through the user selects the payment type and ticks a box if payment has been received.

On a report for delivery drivers, the owner wants it simple for the driver... he wants all the payment types listed with a checkbox next to each one, then wants the appropriate box ticked if payment has been received.

So I need something on the report (or underlying query) which ticks the appropriate box, i.e.

If payment received = true then payment type checkbox = true.

Or should I put the payments into a separate table with both fields so multiple payment types can be marked as paid?

View 6 Replies View Related

Checking One Box

Apr 12, 2005

It should be exceedingly simple, but I got mashed potatoes between the ears today.

I make a query looking up for Name+Firstname+Ref number which I display in a tabular form .

Now, I want to use check boxes to select the ones I wants to print. But the thing is, if I add a check box in the main part of the form, it'll be the same box for all records. Not what I want.

So, how to create (add) a column so I can check individual records in the form?.

Thanks

View 2 Replies View Related

Checking If The Same Name Is In The System?

May 31, 2006

I have a form where I enter student names, and it often happends that I enter the same student a couple times, Is there any way to let the user know that there is allready someone in the system with the same name, like a pop up message.:confused:

thx

View 7 Replies View Related

Error Checking

Aug 24, 2007

hello all,
I have no idea how to run error checking
I get this error
can't append all the records in the append query.
i want a custom error to come up instead of that.
PLEASE HELP.

View 1 Replies View Related

Checking Date Availability

Jan 5, 2006

Hi all, hope you can help me:



Basically what im trying to do is a database which checks to see if something is available.

The database is a booking system for services. I need the database to check a "booking" table to see if there is a booking on a specific date. If there is, then you cannot make a booking. If there isn't then you can.

In my "booking table" there is a list of dates of bookings. Each booking lasts a week. So if someone wants to make a booking, it cant just check to see if the first day is available, it needs to check for 6 additional days. (i.e. a booking on 01 Jan 2006). If someone wants to make a booking, the database needs to account for a whole week, so the next available booking would be on 07 Jan 2006).

How can this be done in the simplist way?

Thanks all.

View 1 Replies View Related

Checking To See If A Table Exists.

Dec 12, 2005

I'm running the following line:

dbs.Execute ("DROP TABLE [tbl_No Certs]")


the problem is that sometimes the table doesn't exist... Instead of trapping the error code, is there a way I can check to see if the table exists? If it doesn't I'll simply skip this step of my code and move on.

Thanks!

View 2 Replies View Related

Checking If A Table Exists

Dec 13, 2005

I have tried the attached code from a previous post http://www.access-programmers.co.uk/forums/showthread.php?t=98727&highlight=table+exists but some of the code doesn't work on Microsoft Access Project.
Does anyone have any ideas how I would amend this code so that it works?

Regards
Carly

View 2 Replies View Related

Checking Isnull For Two Fields

Sep 27, 2005

Hi all,

I had a little problem with delete query. I would like to delete the records by checking two fields if both fields are empty. I mean if a records had both these fields are empty only. If one of the field has data , the record should stay there.. Is there any way I can do this?


Thanks in advance.


Thanks

View 4 Replies View Related

Checking For Attached File

Jan 25, 2005

I would have thought this was easy, but I keep getting an error.
I have a form with a save button. When the save button is clicked, I want it to check if user has attached an OLE object to a bound object frame. If they have, I'd like a checkbox to be true.
Here's the code I tried:
If Attachment.LpOleObject = 0 Then
Attach.Value = False
Else
Attach.Value = True
End If
This seems so incredibly straight forward and it does work if there is an attachment. If there isn't I get the message that my database can't retrieve the value of this property.

Any help would be greatly appreciated.

View 4 Replies View Related

Checking Credit Limit

Apr 5, 2005

Hi, I'm trying to do up a database for a furniture company.
I used Northwinds as a guide and made a similar Orders form.

However, I need another functionality which Northwinds do not seem to have. I want to check whether the currect Order would cause the customer to exceed his credit limit.

WHAT I DID
For this, I made a query to find the amount any single customer owes to date and the amount that he can still borrow(creditlimit-amountowed+amountpaid). I then made a button which launchs this query.

PROBLEM
The problem is I want when i click this button, the query prompts me for CustomerID, which i have to key in again. Then, it launchs the datasheet showing me the credit he would have remaining if this order went through.

It would be better if I do not need to key in his ID again, since it is already on the form when i keyed in the Order.
Further, it would be much better if I could get the button to display APPROVED/REJECT(postive/negative balance) and also display the amount of the remaining credit.

Sorry for the long description. Thanks for reading and please let me know if I missed out any crucial details.

View 2 Replies View Related

Checking For Duplicate Values

May 10, 2005

Hi,

I have a form in a database for our products (doors). I have a button that duplicates one of these records (all new products are based on standard template records).

When this record is created a new product number is produced by the system which was the number of the original (template) record plus the customer enquiry number.

I want to be able to warn the user if they are trying to save this newly created record with a product number that already exists so that they can alter the number to be unique. It will also warn them if they re-number an existing record to another already existing product number. Since the field is defined as unique, at present the system says absolutely nothing and just doesn't save the newly created record which seems is a touch annoying!

I have tried several things with dlookup, dcount arguments but can't seem to get anything to work.

Hopefully someone here can point me in the right direction?

Thanks in advance

John

View 2 Replies View Related

Problem With Checking For Duplicates

May 15, 2005

I have a table that stores jobs. The primary key field is JOBID which will correspond to company invoice #'s. Because the Invoice #'s are generated by a different system, I don't not have this as an autonumber field, I want to control it programatically when the user enters a value into the JobID textbox.

At first, I was using DCOUNT on the BeforeUpdate event of the form to check if there was already a matching JobID in the table, and if so, cancelling the update.

intInvoiceCheck = DCount("[JobID]", "jobs", "[JobID]=" & Me.JobID)

If intInvoiceCheck > 0 Then
Response = MsgBox("You have entered an Invoice # that is already used." & _
Chr(10) & Chr(13) & Chr(10) & Chr(13) & _
"If this is a secondary invoice considering adding 'a' or 's' to make it unique." & _
Chr(10) & Chr(13) & _
"For example, " & Me.JobID & "a, " & Me.JobID & "s...", vbOKOnly, "Duplicate Invoice")
Me.JobID.SetFocus
Cancel = True
Exit Sub
End If

However, if the user is changing say a jobsite address, they can't, because it checks and sees that intInvoiceCheck = 1 and won't continue.

I tried moving my routine to the BeforeUpate event of the JobID textbox like this (this is not the final code, only what I testing with)

'Check that the entered Invoice Number value is unique
Dim intInvoiceCheck As Integer
Dim Response

intInvoiceCheck = DCount("[JobID]", "jobs", "[JobID]=" & Me.JobID.Value)

If intInvoiceCheck > 0 Then

MsgBox ("Dupe")
Cancel = True
Me.JobID.Undo

End If

However, I getthis long error message saying I have changed the validation rule of the field without first checking to see if it's valid....

I can change the to Me.Undo, which works fine, but I don't want to undo the whole entry, only the JobID and set focus to it, and make the user enter a new one.

Can anyone help me out with this?

Thanks,
Hammy

View 3 Replies View Related

Checking For Duplicate Numbers

Jan 31, 2006

I have a form in which new equipment is added. I want to be able to check when the ID number is added (first field on the form) that there is not a duplicate ID number. If I wait till the end of the form and save, then Access tells me that there is a duplicate present but by then I have spent time putting in all the rest of the data.

If have added this code in the before update section for the relevent field, but it doesn't seem to work. Can someone please help clarify or suggest an easier way

Dim IntIDCheck as integer
Dim Response

IntIDCheck = DCount("[EquipmentID]","Equipment Inventory","[EquipmentID] =" & Me.EquipmentID)

if IntIDCheck > 0 then
Response = MsgBox ("Duplicate Present")
Me.EquipmentID.SetFocus
Cancel = True
Exit Sub
End if

Thanks

View 2 Replies View Related

Help Checking For Duplicate Entries

Dec 28, 2006

Hello,

I'm new to using VBA for MS Access. May I enlist your help, Please.

I'm working on a human resources database for a group of employees. I'm trying to automate their login process after they have opened the database so that each employee's privacy is respected. Using an initial form, employees are separated into "New User" or "Returning User". My problem concerns setting up the "New User" in the database.

The New User is directed to form "frm_NU". The form has several unbound fields which are later carried to the table "tbl_Employees". Two of the fields on the form are used to create the EmployeeID. Those are Initials [INI] and Phone Extension [EXT]. The EmployeeID will be used in a filter so that only that employee's information is made available to the user (simulated Privacy).

Because the employees are unfamiliar with MS Access and its cryptic error messages, I need to create a message box which will give a plain English warning when a user attempts to use an existing ID to create a new record. [EmployeeID] is a field in the table. it is set as a key and does not allow duplicates.

When a new user enters his/her initials and phone extension I want the new ID to be compared to the table and if found, a message should appear. This is a preemptive strike to prevent the user from getting to the more cryptic MS Access error message.

I've tried using Dlookup and Dcount to try to pass some meaningful data to the If statement variable VarX to trigger the message box; assuming that Varx should be something other than Null or Empty

Dim EmpID As Variant
Dim VarX As Variant

EmpID = [INI] & [EXT]

VarX = DLookup([EmployeeID], "qry_Employees", [EmployeeID] = [EmpID])

If VarX <Is Not Empty> Then
X = MsgBox("Another record already exists by that name", vbOKOnly)
Else
Y = MsgBox("Passed", vbOKOnly)
End If

I keep getting an error at the DLookup formula or DCount formula saying: Run-time error; 2001 You canceled the previous operation. It also appears that the DLookup never looks up anything nor does DCount count anything even though I'm purposely entering duplicate information which exists in "qry_Employees". I was expecting VarX to be either the duplicate ID or a record number or record count or something.

Any ideas or constructive suggestions?

Thanks,

Goh

View 4 Replies View Related

Checking Email In Database Already

Jan 5, 2006

I currently setup a form for a survey which works fine and all the information that is gathered is stored in an access 2000 database.

The thing i want to do is to only let the person fill out the form using only 1 email address. So if they try to come back and fill out the form again using the same email address, i want there to be a check on the database to see if the email is there. If it is the form wont submit and it will let the person know. If it's not in the database things will work as planned.

this is what i have so far, but when i submit the form it continues on, but it doesnt check and doesnt email or add to the database like it used too...

Code:<%Dim DSNtemp, Conn, SQLDSNtemp = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=DATABASE LOCATION"Set Conn = server.createobject("adodb.connection")Conn.Open DSNtempemail = Request.Form("email")SQL = "Select * From users Where email = '" & email & "'"Set RS = Conn.Execute(SQL)'HERE WE CHECK TO MAKE SURE THE USERS EMAIL EXISTS, IF IT DOES, WE STOP HEREIf NOT RS.EOF Thenx = "Sorry The Email Address You Entered Already Exist!"Set RS = NothingConn.CloseSet Conn = NOTHINGElse'CONTIUES ON WITH DATBASE INSERTION AND EMAIL TO USER.End If%>

View 3 Replies View Related

Checking Multiple Columns + Asp

Oct 16, 2006

Question concerning how to check a value against multiple columns in Access with ASP.

Need help converting this to proper ASP and Access syntax

Code:myId = "test"myName = "monkey"SELECT * FROM table1 WHERE (programId1='" & myId & "' OR programId2='" & myId & "') AND (name1='" & myName & "' or name2='" & myName & "')"

is this doable with asp and Access?

If this helps explain it better, the following is how I would call it with PHP & mysql:

Code:$myId = "test";$myName = "monkey";SELECT * FROM table1 WHERE (programId1 = $myId OR programId2 = $myId) AND (name1=$myName OR name2=$myName)

Any help would be appreciated

View 2 Replies View Related

Checking Whether Path Is Valid

May 14, 2007

I am making an application in Access where a number of image files are copied to a folder in the server. I need a way to find out whether the folder in which the images are being copied to exist so that a new directory can be created if it does not exist. Please help with a code to check for the validity of the existing path.

View 2 Replies View Related







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