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 Replies


ADVERTISEMENT

Quick Searching In Multi-valued Field

Mar 20, 2013

I am trying to make a database containing the technicians of our companies.

I found a online template i am using, and this has a quick search field.

I have created a multivalued field that contains the technicians skills. (pulldown with checkboxes)

When i try to use the quick search field access returns a error message saying something like:

"The multivalued field '[Category]' can not be used in a WHERE- or HAVING-string."

The field i use for skills is an old category field.... Just renamed and changed a bit..

View 4 Replies View Related

Modules & VBA :: Multi Criteria - Checking For A Value To Be Null

Oct 16, 2014

Me.Text11 = Nz(DAvg("[final whse-in diff]", "dbo_inventory", "[CAFETYPE]=" & Me.Text7 And "isnull(me.[DATE FIXED])=" & True And "isnull(me.DATE_IN)=" & True), 0)

I am getting a type mismatch error with this.

My question is:
1. is the syntax correct....
2. Is my way of checking for a value to be null correct....

View 4 Replies View Related

Queries :: Searching Multi Fields In Table

Jun 23, 2014

i have a form with a control for "repair type" and a subform that has a query that searches a table holding vehicle repair records. on the form the user can enter up to 5 repair types, [repair1], [repair2], etc.. Then the control on the form holds each type of repair to search by. Since the user could use one or all five repair fields and put repair types likes brakes in field one on one record and field 5 on another record, how do i search to just pull out those records that have the specified search criteria?

If i put in [form]![control] in each of the 5 criteria in the query it comes back with no records, because it it looking for that type in every repair field rather than once between the five fields?

View 2 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

Error Checking For Table Fields Null Value Constraint

Aug 17, 2005

Hi all. I want to check for not null value constraint for all tables in database . I tried the following but when i run it i get the following error:

Compile error:
Invalid Next control variable reference

I be happy if some one one help me fix this error.if i remove the bold lines the program workes well but it does not put not null for table fileds that requries value.

picture of the output without the bold part

http://i5.photobucket.com/albums/y1...007/notnull.jpg


Code:Option Compare Database''This module displays field name and type in a massage boxFunction ShowFields(pTable As String) As StringDim db As DatabaseDim rs As RecordsetDim I As Integer''Dim j As IntegerDim n As Integer''Dim NL As StringDim strHold As String, ST As String''Dim x As Variant''NL = Chr(13) & Chr(10) ' Define newline.Set db = CurrentDbSet rs = db.OpenRecordset(pTable)n = rs.Fields.CountReDim x(n - 1, 1) As String'''ST = "Create Table " & pTable & vbCrLf''adding Create table and table name to statementST = "Create Table " & pTable & vbCrLf & "("For I = 0 To (n - 1)For Each fld In tbl.Fields ST = ST & rs.Fields(I).Name & " " & FieldType(rs.Fields(I).Type) & "," & vbCrLf If fld.Required = True Then ST = ST & " NOT NULL" & " " Else ST = ST End IfNext Irs.Closedb.CloseSet db = NothingShowFields = ST '' returns the fields name to main functionEnd Function

on click even code

Code: For Each T In db.TableDefs '''Skip the system tables If Left(T.Name, 4) <> "MSys" Then ''' this line determines the primary key of the table ''' by calling GetPk function from module pk = Left(GetPK(T, db), InStr(1, GetPK(T, db), "<-") - 1) cont = cont & ShowFields(T.Name) & vbCrLf & " primary key " & "(" & pk & ")" & vbCrLf & ")" & vbCrLf End If Next T ''' This line of code post the generated table statment to a massage box MsgBox cont

View 1 Replies View Related

Error When Searching

Sep 8, 2005

Hi there

In my form every time i click on the search button a box pops out and asks me if i want to continue or accpet the change. the funny thing is i just search and nothing else.

thanks

i attached a screen shot to help

View 1 Replies View Related

Searching DB Error Too Few Params

Oct 11, 2006

Hi

I am trying to learn how to search my DB based on one param... a querystring called country. the code being used is

Code:<%dim dsndsn="DBQ=" & Server.Mappath("....dbusers.mdb") & ";pwd=password;Driver={Microsoft Access Driver (*.mdb)};"%> <%response.buffer = truedim useraction,subject,Cust_Status,Cust_UserName,Cust_ City,Cust_Country,conn,rs,sqldim idSet Conn = Server.CreateObject("ADODB.Connection")Set Rs = Server.CreateObject("ADODB.Recordset") Conn.Open dsn SQL = "SELECT * from CustRecords WHERE Cust_Country = " & request.querystring("country")rs.open sql,connif rs.eof and rs.bof thenresponse.write "<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><center><b><font face=""Arial,Verdana"" size=""5"" color=""#FF0000"">Sorry!</font></b>&nbsp;&nbsp;<b><font face=""Verdana"" size=""2"" color=""#000080"">There are no records of Register Users in our Database.</font></b><br><font face=""Verdana"" size=""2"" title=""Click Here""><a href=../login.asp>Click Here To Continue</a></font>"elseresponse.write "<table>"do while not rs.eofif flag = 0 thenflag = 1bgcolor = "#CFCFCF"elseflag = 0bgcolor = "#E9E9E9"end ifresponse.write "<tr bgcolor=" & bgcolor & "><td>"id = rs("id") & " "Cust_UserName = rs("Cust_UserName") & "</td><td>"Cust_Status = rs("Cust_Status") & "</td><td>"Cust_City = rs("Cust_City") & "</td><td><a onclick='return showuser()' href='showuser.asp?id="& id &"'>View</a></td>"%>

It keeps returning the too few param error but I have checked the spelling etc in the table and that is right and am now sctumped. Could any of you gurus show me the light lol

View 3 Replies View Related

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 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 5 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

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

Searching More Than One Field

Apr 3, 2006

Hello,

I'm new to using Access, and come from a library background, and I'm trying to use Access to build a library database. So far it's going well, but when it comes to searching using a form and applying a filter I can only get it to search one field at a time, and really I want to search two or more depending on which field I'm using.

Is this possible? and how do I do it?

Any help very would be gratefully received.

Thanks

Mozz

View 5 Replies View Related

Searching A Field For Specific Data

Jun 14, 2006

Hello everyone,

Ive designed a databse - no problem. Ive done all queries I need to - no problem. Ive designed forms for entering data and reports for showing data - no problem. THE ONE PROBLEM I have is with 1 field.

The problem is that the field is a memo box, used to add data on groups attended. For example: General, customer care, mystery shopping.

Can I run a query so that a different user can search the memo box for attendence to a certain group? eg, search this databse and field for customer care.

At the moment I can only seach on the first word in the field. I dont really want to have seperate fields as each employee can have attendence to different groups ie bo can have just general while bill has general, mystery shopping, customer care etc.

Any help would be great

View 6 Replies View Related

Searching Combo Box For Text Field

May 25, 2005

:mad: I have a combo box which is being used for surname searching. It displays surnames in the first column and first names in the second column. I would like the user to be able to type or select a surname from the dropdown list and where there are multiple entries of that surname select the correct record. At present the first matching surname is the one that keeps being selected.

I am displaying the complete record in fields lower down in the same form.

I also have a firstname search combobox but the code will be almost identical.

Can someone help me with this problem. Thanks in advance.

View 2 Replies View Related

Searching For Certain Field Name From Multiple Tables

Dec 22, 2011

I have around twenty shipment tables for different days and one main store check table.In the shipment tables i have bill numbers that correspond with shipping id's and in the store table i only have bill numbers.

I would like to check if the bill number in the store table appears in all 20 tables.after doing that i want the corresponding shipping ID to appear in the store table. Is this possible?

View 5 Replies View Related

Searching For Any Word In A Memo Field On ASP Page

May 1, 2008

Hi there, I am currently working on our intranet at work and am creating an Access database so we can record all of the box files at our storage facility.

One of the fields is called 'contents', which is a Memo field, where the person who is inputting the data will describe what is in the box. They will then use the autonumber generated by the database to label that box.

That way we can locate the boxes much easier than at the moment.

I have created a results page with a search box at the top using ASP in Dreamweaver CS3 and it works fine if I replicate EXACTLY what is written in the contents memo field.

ie: if the contents field for record number one reads

'Archived box of insurance documents dating back to 1999'

I would need to type in that exact phrase to pull that info back.

What I want it to do is if I was to put in '1999' or 'insurance' then it would return the same result (and others with those specific words).

What do I need to do in my code?

Here is the current code

Code:<%Dim rs__MMColParamrs__MMColParam = "1"If (Request.QueryString("content") <> "") Then rs__MMColParam = Request.QueryString("content") End If%><%Dim rsDim rs_cmdDim rs_numRowsSet rs_cmd = Server.CreateObject ("ADODB.Command")rs_cmd.ActiveConnection = MM_intranet_STRINGrs_cmd.CommandText = "SELECT * FROM archive WHERE content = ?" rs_cmd.Prepared = truers_cmd.Parameters.Append rs_cmd.CreateParameter("param1", 200, 1, 255, rs__MMColParam) ' adVarCharSet rs = rs_cmd.Executers_numRows = 0%><%Dim Repeat1__numRowsRepeat1__numRows = -1Dim Repeat1__indexRepeat1__index = 0rs_numRows = rs_numRows + Repeat1__numRows%><%Dim MM_paramName %><%' *** Go To Record and Move To Record: create strings for maintaining URL and Form parametersDim MM_keepNoneDim MM_keepURLDim MM_keepFormDim MM_keepBothDim MM_removeListDim MM_itemDim MM_nextItem' create the list of parameters which should not be maintainedMM_removeList = "&index="If (MM_paramName <> "") Then MM_removeList = MM_removeList & "&" & MM_paramName & "="End IfMM_keepURL=""MM_keepForm=""MM_keepBoth=""MM_keepNone=""' add the URL parameters to the MM_keepURL stringFor Each MM_item In Request.QueryString MM_nextItem = "&" & MM_item & "=" If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item)) End IfNext' add the Form variables to the MM_keepForm stringFor Each MM_item In Request.Form MM_nextItem = "&" & MM_item & "=" If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item)) End IfNext' create the Form + URL string and remove the intial '&' from each of the stringsMM_keepBoth = MM_keepURL & MM_keepFormIf (MM_keepBoth <> "") Then MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)End IfIf (MM_keepURL <> "") Then MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)End IfIf (MM_keepForm <> "") Then MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)End If' a utility function used for adding additional parameters to these stringsFunction MM_joinChar(firstItem) If (firstItem <> "") Then MM_joinChar = "&" Else MM_joinChar = "" End IfEnd Function%>



and for the search form:

Code:<form id="content_search" name="content_search" style="margin: 0px; padding: 0px;" action="archive_results2.asp"> <label> <input name="content" type="text" id="content" value="" /> </label> <label> <input name="button" type="submit" class="directory_form_button" id="button" value="Search Content" /> </label> </form>

Thanks for any help that could come my way!!

Cheers

View 2 Replies View Related

Searching For Records Based Off Of One Field From A Table

Mar 19, 2014

I have a database that I am creating for my work. I have a form that I am trying to get it to search the information from a table to pull the record on the form. I would like to search infomation such as employee id and wanting it to pull that information from the table.

View 7 Replies View Related

Query Searching Multiple Tables' Field Names (not Values)

Jan 22, 2007

Hi. Please do not lecture me on database normalization, as this truly is not in my control.

I have 2 dozen tables, each with 13 fields. All of the field names exist in at least 12 of the tables. And all tables share a ssn field where values are common.(Confused yet? Sorry, if you are...)

If I design a query showing all 2 dozen tables and their fields...
Can I set up a query criteria where I enter the requested ssn and then the required field name and have the result show the values of all the fields with that name, among the ones of the 2 dozen tables where that field name exists? (for that specified ssn)

If I am only as clear as mud, please let me know, and I will try again.
Or, by asking if I can search for field values querying by field name, am I any clearer?

Russ

View 14 Replies View Related

Multi-field Index

Dec 29, 2005

I am trying to set a multiple field index on a table. I would like to use 3 fields. One is a text field, the other two are date fields. The text field and one date field will always have a value. The other date field can either have a value or no value. The index will work if I only use the text field and date field that always have values. If I try to add the third field, it will not find a duplicate record. Can I not include a field that may have a null value?

View 5 Replies View Related

Multi Field Validation

May 25, 2005

Found some great code, else where that perhaps someone else can use.

Each required fields tag property - change to required
Dim blnContinue As Boolean
Dim ctl As Control
blnContinue = True
For Each ctl In Me.Controls
If ctl.Tag = "Required" Then
If IsNull(ctl) Then
MsgBox "Required Information Missing", vbCritical + vbOKOnly + vbDefaultButton1, "You must fill in the x xx xxx xxxx fields"
Cancel = True
ctl.SetFocus
Exit For
End If
End If
Next ctl
Set ctl = Nothing
End Sub

View 1 Replies View Related







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