Search - Missing Number

Jul 6, 2006

I have tried to search for an answer to this but no no avail! Please could someone help?

I have a start-up form, which has a combo box search feature which opens up a new form with the user defined record. As well as providing all present numbers users can type in their own number. The number it is searching is an AutoNumber. I tried to put in some error messages if the user selected a number greater than the maximum value using DMax

If cboSearch > intMax Then
MsgBox "Not there", vbCritical + vbOKOnly, "Does not exist!"
Exit Sub

This works really well. The problem I am having is that if entries have been deleted then there is a gap in the numbering, which in itself isn't a problem. But if the user enters a number not present then it just opens the correct form but with the first record. Is there a way of bringing up a message box informing the user that the value they have entered does not exist in the form they are searching?

Many thanks,

CC

View Replies


ADVERTISEMENT

Modules & VBA :: Invalid Argument With Search Box - Missing Space Or Quotation Marks

Mar 25, 2014

I found this code on a website that uses a form to search all tables in my database. Problem is that when I click "search" I get an invalid argument error. I am guessing that there is a problem with my SQL string. Missing space? Missing quotation marks? etc etc.... Anyway, here is the code:

Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Dim rs As DAO.Recordset
Dim strSearch As String
Dim strTableName As String

[Code] ....

View 1 Replies View Related

Refernece Number Missing Digit During Form Transfer

Dec 6, 2006

i have a jobref (pk) as text at the moment because i tried it as Number data type and had a problem..a reference number is made and when the date loses focus the refno is displayed in its textboxthis makes that refnoPrivate Sub cbojobdate_LostFocus()Dim maxRef As Variant, maxID As IntegerDim codeDate As String, maxDate As String codeDate = Format(cbojobdate, "MMYY") maxRef = DMax("jobref", "job", "jobref like '" & codeDate & "*'") If (IsNull(maxRef)) Then 'test for new month maxID = 0 'reset id to 0 Else maxDate = Left(maxRef, 4) 'get date code maxID = CInt(Right(maxRef, 4)) 'convert to int End If Me.cbojobref = codeDate & Format(maxID + 1, "0000")End Sub8 digits.. so a job on september 6th 2006 will have a ref no of 09060001a job on february 1st 2006 will have ref no of 02060001when i send the jobref to another form using this..Private Sub cbojobfrom_AfterUpdate()If Me.cbojobfrom = "t1" ThenMe.cbojobfrom = "LHR - T1"End IfIf Me.cbojobfrom = "t2" ThenMe.cbojobfrom = "LHR - T2"End IfIf Me.cbojobfrom = "t3" ThenMe.cbojobfrom = "LHR - T3"End IfIf Me.cbojobfrom = "t4" ThenMe.cbojobfrom = "LHR - T4"End IfIf Me.cbojobfrom = "h" ThenMe.cbojobfrom = "LHR"End IfIf Me.cbojobfrom = "ga" ThenMe.cbojobfrom = "Gatwick Airport"End IfIf Me.cbojobfrom = "gn" ThenMe.cbojobfrom = "Gatwick North"End IfIf Me.cbojobfrom = "gs" ThenMe.cbojobfrom = "Gatwick South"End IfIf Me.cbojobfrom = "st" ThenMe.cbojobfrom = "Stansted"End IfIf Me.cbojobfrom = "lc" ThenMe.cbojobfrom = "London City Airport"End IfIf Me.cbojobfrom = "lu" ThenMe.cbojobfrom = "Luton Airport"End IfDoCmd.OpenForm "job_cash_inflight", , , "[jobref]='" & [jobref] & "'"End Suband the job_cash_inflight form loads it with this..Private Sub Form_Open(Cancel As Integer)Me.[jobref].DefaultValue = Forms!job_cash_single![jobref]End Subthe problem is when i choose february the first for example02060001.. when the reference number transfers to the incoming flight form.. it displays as 2060001can anyone see why because before it transfers the refno.. the original job record has already been saved.. maybe when the id is being created it is not the best way.. or it doesnt match the text datatype.. if that is the case what number datatype shall i use in each of the tables jobref appears in?

View 14 Replies View Related

General :: Fill In Missing Number When Adding A Record

Jul 5, 2013

I am working on a database where the records are numbered sequentially. On a regularly basis, records will be deleted leaving a gap in the record number sequence. I would like to have my db recognize that a number(s) is number in the sequence and use the missing number (filling in the gaps) when a new record(s) is added until all spaces are filling and then to continue from the largest number sequentially.

View 2 Replies View Related

Search On Part Of A Number

Jan 16, 2006

I have a data base with the field named "PartNumber" this is a 13 diget number. How can I search on the last 7 digets only

View 2 Replies View Related

Search For A Number Not A Text, SQL

Aug 12, 2005

I have a form with four combo box that will search for a record, as follow:

Field Name "Printer" , DataType "Text"
Field Name Month" , DataType "Text"
Field Name "Year" , DataType "Number"
Field Name "Day" , DataType "Number"

code for Find Record Button:


If Not IsNull(ID) And Trim(ID) <> "" Then
StrSQL = StrSQL & " And [Id] = " & [ID]
End If

If Not IsNull([txtname]) And Trim([txtname]) <> "" Then
If InStr([txtname], "*") = 0 Then

StrSQL = StrSQL & " And [Name] = '" & [txtname] & "'"
Else
StrSQL = StrSQL & " And [Name] like '" & [txtname] & "'"
End If
End If

'================================'


If Not IsNull([txtyear]) And Trim([txtyear]) <> "" Then

If InStr([txtyear], "*") = 0 Then

StrSQL = StrSQL & " And [Year] = '" & [txtyear] & "'"
Else
StrSQL = StrSQL & " And [Year] like '" & [txtyear] & "'"
End If

End If

'================================'


If Not IsNull([txtmonth]) And Trim([txtmonth]) <> "" Then

If InStr([txtmonth], "*") = 0 Then

StrSQL = StrSQL & " And [Month] = '" & [txtmonth] & "'"
Else
StrSQL = StrSQL & " And [Month] like '" & [txtmonth] & "'"
End If

End If

'================================'


If Not IsNull([txtday]) And Trim([txtday]) <> "" Then

If InStr([txtday], "*") = 0 Then
StrSQL = StrSQL & " And [Day] = '" & [txtday] & "'"
Else
StrSQL = StrSQL & " And [Day] like '" & [txtday] & "'"
End If

End If

'================================'


This is only a part of the code, I have a problem with year and day since they are numbers not text I was told that i cant use this line:

StrSQL = StrSQL & " And [Month] like '" & [txtmonth] & "'"

I was told that there is no need to use "like", am not really sure how to do it, any help will be appreciated.

Thanks.

View 2 Replies View Related

Serial Number Search Query

Feb 28, 2008

Hope someone can help

I have a small test database which I'm doing for our dispatch dept.

It contains: Order No. / Customer / Ship_Date / Serial numbers (multiple)

I'm looking for a way to create a search query that will search though all the records to find a particular serial number.

There fields in the table are:
Shipping_Date
Customer
Order_No
Pallet_ID
Serial_1
Serial_2
Serial_3
Serial_4
etc

I need it to come back with the order number and pallet that it was shipped on.

Any ideas?

Thanks,

Paul

View 11 Replies View Related

Search Queri Social Security Number

Mar 17, 2006

HI

I have a query that looks like this:
Like [Forms]![Searchaddress_form]![search_3] & "*"
The filed name is "ssn"

In a form I have an unbound field that is called "search_3" and when I type a number or more and hit enter it's supposed to look it up in the table. But itīs not working

FYI! It works whith letters. I have the same query for searchin first name and it works.
But not with numbers.

Any suggestions?

//Mikael

View 3 Replies View Related

Use Form & Query To Search For Text & Number

May 19, 2006

Hello,

I have a form with a listbox on, the listbox uses a query to populate it, which returns a list of client names. The idea is, when I enter the clients name in a text box, the list is narrowed, through use of the query.

This works fine, and always has - very pleased with it, the problem comes when I decide I want to be able to search on the account number as well - which it always throws errors about.

I am using the following query (posting the sql, hope that is OK)

SELECT tblSafeKeep_Clients.SafeKeepClientID, tblSafeKeep_Clients.Title, tblSafeKeep_Clients.Initials, tblSafeKeep_Clients.Surname, Format(tblSafeKeep_Clients.DesignationNumber,"000000") AS Expr1
FROM tblSafeKeep_Clients
WHERE (((tblSafeKeep_Clients.Surname) Like "*" & [Forms]![frmSafeKeep_SelectClient]![txtSearchText] & "*")) OR (((tblSafeKeep_Clients.DesignationNumber)=[Forms]![frmSafeKeep_SelectClient]![txtSearchText]));


The problem is because I am only using ONE text box, but the surname is (obviously) text, and the account number is (obviously!) a number. SO - it throws a wobbler about it being too complex to evaluate when I try to search for a surname, trying to search for an account number works just fine.

Any ideas how to get around this?

View 3 Replies View Related

Queries :: Search Like And Phone Number Format

Apr 12, 2013

I have the following VBA code to search for a string

Code:
'Search by Phone
Private Sub CmdSearchPhones_Click()
Me.Refresh
strSQL = "SELECT Tbl_Contacts.ContactID, Tbl_Contacts.FName, Tbl_Contacts.LName, Tbl_Contacts.Address, Tbl_Contacts.City, Tbl_Contacts.State, Tbl_Contacts.Zip, Tbl_Contacts.HomePhone, Tbl_Contacts.WorkPhone,

[Code] .....

My issue is that this works 50/50, because phone numbers on the database are NOW being stored in this format (000) 000-0000 and previous DB phone numbers got stored as 0000000000. The above code finds previous DB phone numbers (even if we dont enter all 10 digits) without a problem but has issues with new phone numbers stored in the new format UNLESS I specify the search with (000) 000-0000 (but we want to be able to search without adding that and without typing all 10 digits - in case we forget part of the number we are looking for)

How can I tell my query to find both formats, with the (000) 000-0000 AND 0000000000 ....

View 4 Replies View Related

Queries :: Parameter Query To Search For Number

Feb 11, 2015

I have 2 tables: Table A contains [ID] (and other columns) AND Table B contains [Request ID] (and other columns).

However, [Request ID] contains several number separated by comma. For example: 10, 15, 20 etc.

I created a query with parameter with : Like "*" & [ID] & "*" under [Request ID] criteria.

Here is my problem:

if [Request ID] = 44, 60 then it is returning [ID] 4 records (4, 6, 44, & 60). Is there a way to show only 2 records? 44 & 60?

View 4 Replies View Related

Missing Records (and Missing Updates)

Oct 7, 2005

Hi all

This is an ongoing problem I have had for 4 weeks now.

I have made a a system thats acts like a clock In/clock out Out system.

the structure is somthing like this
ID
Username
tblDailyLog
TimeIn
MorningBreakOut
MorningBreakOut
LunchOut
LunchIn
AfternoonOut
AfternoonIn
TimeOut

All fields apart from ID (autonumber) and username (String*255) are Date field (there are a few others like DateOfTimesheet etc but they arnt important here)

When a user arrives in the morning they make a record which they use for the day

They then have a form with a whole bunch of buttons which simply updates the correct field. For example they click the "Sign in for the Day" button and it updates the correct field with the current time.

Everything was going fine until people noticed that every now and again a sign in time dissapeared.

I have hacked myself to death trying to solve this problem but still the updates go Astray.


Now each time a time is updated the process goes somthing like this


1. the user opens their timesheet for the day (the RS is SNAPSHOT and no locks)

2. User Hits a sign in/out button
3. The record source is changed to "" and all buttons hidden (to ensure the record isnt locked and to make sure you dont do two things at once)
3. The table is updated with the new time (using some dynamic SQL)
4. The table is repeatadly checked using a DO loop to make sure the the correct time went in.
5. when the returned time value of the field matches the varaible used to update it, the form is returned to normal and the user carries on his/her merry way (if it never matches the screen should crash but this never happens).
6. A New record is added to another table called "tblbugfixinglog" which records which field was updated and when. This is so that I have two records in two different ways (figured if one went astray I could pull it back off the other)
7. Another new record is added to yet another table called tblSQLRecord, which simply logs all .RUNSQL statements that are executed.


I thought that the two extra tables (and the check that the record had been updated) would help me track down where the records are going missing, but this isnt the case.

Now it appears that some records arnt being added to tblBugFixingLog and to tblSQLRecord either and some of these tables are getting quite a few #ERROR's in them..

None of the tables are related to any other and i've no idea how #ERROR lines are appearing in a table that has 1 function... to recieve new records ... no editing, no viewing, no deleting.

Does anyone have any idea how these updates/inserts can go missing or create #ERRORs.
I've built plenty of Databases in my time and have never come across this.
__________________________________________________ ______________

This is the function I use to add a record to tblBugfixingLog and tblSQLRecord


Private Sub AddBugLog(ByVal TimesheetNumber As Long, ByVal FieldUpdating As String, ByVal NewFieldValue)
Dim TempSQL As String
TempSQL = "INSERT INTO tblBugFixingLog (TimeAndDateOfEntrySERVER,TimeAndDateOfEntryPC,Fie ldUpdated,NewEntry,UserID,TimesheetNumber,Computer AssetNo) VALUES (" & _
"#" & Format(ServerGetTime(Environ$("LOGONSERVER"))) & "#," & _
"#" & Now & "#," & _
"'" & FieldUpdating & "'," & _
"'" & NewFieldValue & "'," & _
"'" & GetNTUser & "'," & _
"'" & TimesheetNumber & "'," & _
"'" & fOSMachineName & "')"
' MsgBox TempSQL
DoCmd.RunSQL "INSERT INTO tblSQLRecord (Username,DateAndTime,Screen,TheSQL) VALUES('" & LoginInfo.sUsername & "','" & CStr(Now) & "','Add Bug Log function','" & CleanData(TempSQL) & "')", False
'CleanData is a function that removes ' and " from the SQL string so i can easily add the SQL string into the table
DoCmd.RunSQL TempSQL, False
End Sub

Public Function CleanData(ByVal DataToClean As String)
Dim TempData As String
Dim i As Integer
TempData = ""
For i = 1 To Len(DataToClean)
Select Case Mid(DataToClean, i, 1)
Case "'"
TempData = TempData & "`"
Case """"
TempData = TempData & "`"
Case Else
TempData = TempData & Mid(DataToClean, i, 1)
End Select
Next i
CleanData = TempData
End Function


__________________________________________________ ____


I have no idea how this can create #ERROR lines in the table when it is just added to and nothing else.

Does anyone have any clue to what may be happening here.

(Oh yeah and no matter how hard I try, I can't replicate the problem.... works for me every time no matter how harse I am to it!)

Please save what little hair I have left and give me some hope

Cheers
Homer

View 1 Replies View Related

Queries :: Telephone Number Search Area Code (STD)

Oct 27, 2013

What I am trying to do is i have a list of area codes connected to other data

What I want to do is do a search on a telephone number and this will check against the area codes and diaplay the required info

Example

Area info1 info2
01234 ab cd
012345 ar mc
01235 fg tr

So if I put a number like 01234567890 in the search box the result it will show is 012345 ar mc as this si the closet match to the telephone number.

I did it in excel with
=INDEX(whatwouldbedisplayed,MATCH(searchinfo,rowof data,1))

Im not to sure if this can be done as a query so would it have to be a macro?

View 2 Replies View Related

Forms :: Enter Tracking Number - Click Button To Search Record On Form

May 24, 2013

I currently have a database where new records can be entered in a "New Part" Form and Records can be viewed(but not altered) in a "Part Search" Form. The forms are the same except one is allowed to edit. I have also created another form where I am trying to search the "Part Search" Form via a tracking number. I want to have a text box where users enter a tracking number then click the button to take them to the record on the "Part Search" Form.

View 2 Replies View Related

VBA - Search Button To Search Entire Records / Runtime Error 3345

Jun 18, 2014

why the code below is not functioning properly. When I type in an acronym in the textbox, it keeps saying there is an error "Run-time error '3345': Unkown or invalid field reference 'ABO'." I do have ABO in the field.

The dysfunctional code:

Code:
Private Sub btnFind_Click()
If (TxtFind & vbNullString) = vbNullString Then Exit Sub
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.FindFirst "[Acronym] = " & TxtFind

[Code] .....

The red highlighted line is where the debugger leads me to. Something with identifying the field? I would like to enable the search procedure to search throughout the entire records rather than just a specific field. How may I write such a line or two?

View 5 Replies View Related

Modules & VBA :: Search Code Deactivates Navigation Buttons When Search Results Are Longer Than A Page

Jun 24, 2015

I have a form that has a subform on it. The main form shows a category of furniture and has custom navigation buttons and a search text box for asset numbers and command button that runs the search. The subform shows the asset numbers associated with that furniture category, sometimes there is only one asset number, in other cases there could be 60. There is a scroll bar to scroll through the asset numbers when there are too many to see in the initial window.

The buttons all work as they should except when I search for an asset number that is part of a category that has too many asset numbers to show in the main window. When this happens the "previous" and "next" navigation buttons do not take you to the previous or next record. All of the other buttons on the form work though - you can go to the first, or the last record, and you can search for a new asset.This is the code for the search:

Code:

Private Sub cmdAssetSearch_Click()
Dim rs As Object
If IsNull(Me.TextAsset) Or Me.TextAsset = "" Then
MsgBox "Please type in an asset number to search for.", vbOKOnly
Me.TextAsset.SetFocus

[code]....

I've also attached a picture of what I mean when I say there are more asset numbers than what the window shows.

View 6 Replies View Related

Queries :: Add A Box On Search Forms To Search 3 Cells Of Record For A Keyword

Jun 10, 2013

I currently have a database with a few search forms. I recently attempted to add a box on one of my search forms to search 3 cells of a record for a key word. What happens is when I go to search, say for P0442, it does not bring up all of the records that contain that keyword in the 3 cells I have outlined. If I step down the code in the OR boxes of the query, it seems to work better but then for some reason my other search criteria , (Tracking number etc) does not work. I will upload the database for reference. I am currently working on the Search(View Only) and that is where you will find the query to work on.

View 3 Replies View Related

General :: Search On Google And Return First Link From Search Page

Sep 21, 2012

I'm having Table with some universities name and i want web link address for all universities. Take university from table1 in column1 and search on google page and return first link of the search page and save into column2...

View 1 Replies View Related

Queries :: Search Form That Uses A Query To Show Results Of A Search

Aug 5, 2014

I have a search form that uses a query to show results of a search, but everytime I press search everything comes up even though I have entered search parameters, even though my search requeries every time and the search used to work before I added new records today. Also when I press the query alone on the navigation pane it asks me for the parameters and then it actually works but it won't when I use my form.

View 2 Replies View Related

Using Subform For Search Criteria And Relating One Search Field To Several Columns

Apr 21, 2015

1. I created a form with some search-fields which are related to a query. Then I added a Subform in which I put some more Search criteria (So that I can easily hide and unhide those additional searchfields). It sounds strange but is necessary ;-). Now I related those searchfields in the subform to the same query. When I run that query a window pops up that I should put in a value in all those searchfields which are in the subform. But I told Access that it should display all rows, if there is no value in those searchfields. Just as I did it with the Searchcriteria in the Main form. Do I have to do something special, when I have a query which is related to two Forms?

2. I want a searchfield to search in three different columns. Usually the value will just be found in one of those columns. As the Table I search is very long and has many searchfields and multiple of those will relate to more than one column, is there an easy way to do it in VBA? As I did it by using the "or" field when designing a query, but this seems very slow and unstable.

View 6 Replies View Related

How To Create Search Button Using Access 2007 That Can Search From Form

Jul 10, 2012

i need to create a system that can search data using keyword.so i want to create search button that i will create it at form. currently i have 1 table and in that table i have 10 fields which are project_name, doc_ref_no, doc_title, volume, book_no, author, doc_status, box_barcode, filling_location, doc_availability.

i have create 2 forms, one form for user to add new record and another one is to search record. the user can search by enter project name, doc title, volume and box barcode. for project name and volume, i use combo box and for doc title and box barcode i'm using text box.

i want to create search function that can detect from user keyword and even user did not fill in all the form, the system still can search the record.

View 5 Replies View Related

Forms :: Search Text Box With Option Box As Criteria For Search

Mar 4, 2014

I am creating a a text box where the user enters a text then clicks an option from the option that is used as the criteria for the search e.g. Last Name, Phone , address then a command button wil run a query.

View 3 Replies View Related

Forms :: Search Combo Box To Search For A Field On Form

May 7, 2013

I have a search combo box to search for a field on my form. But it just goes to that particular record. The combo box is for client id and it has more than one record. How can I have it return just the records pertaining to the client id choosen in the combo box.

View 5 Replies View Related

Using One Search Button To Search 4 Tables In A Database?

Mar 10, 2008

I have a database that uses four forms and each form has it's own table and each form has it's own search button to find a specific record within that table. I would like to use one search button that will look at all four tables and bring up the correct record when the request number is entered. Can I link all the tables to perform this or is code required? Can someone send me in the right direction for how to do this? Give me an example of code if it's required?
Thanks for any help I can get.

Laura Edmark

View 7 Replies View Related

How To Search For Words Out Of Order In An Access Search

May 15, 2006

So basically, what I have is a bunch of words in one memo field, for example:

dog cat cowboy tree flower

To search it, this is the code I have now.

' Check for LIKE Last Name
If Me.txtLastName > "" Then
varWhere = varWhere & "[LastName] LIKE """ & Me.txtLastName & "*" * " AND "
End If

The only problem is what I search for needs to be "in order", for example, if I search for dog, I'll get the table. But, if I seach for tree, I won't because tree was not place first. Can you please help me? Thanks a lot!

View 1 Replies View Related

What Am I Missing?

Sep 19, 2007

When I run this Query without the WHERE statement/Clause- it returns the accurate 985 records. However, when I include the criteria with the WHERE clause (it takes a range of +/- 10% of the Square Footage size into consideration), I lose 15 records, and only get 970 results. When I increase the range to +/- 15% in that field, it gives me 7 more records back.

Obviously it is dropping out records that do not meet the criteria for that field- how do I prevent that? I guess I would like it to display a ZERO or something, but still display the entire 985 records. What do I need to include to do that? Here's the SQL-

SELECT tbAct.MLS, tbAct.Status, tbAct.Address, tbAct.City, tbAct.Area, tbAct.SqFt, tbAct.Level, Avg(tbSold.SoldPrice) AS AvgOfSoldPrice, Count(tbSold.SoldPrice) AS CountOfSoldPrice
FROM tbListing AS tbAct, tbListing AS tbSold
WHERE (((tbSold.SqFt) Between ([tbAct].[SqFt]+([tbAct].[SqFt]/100*10)) And ([tbAct].[SqFt]-([tbAct].[SqFt]/100*10))))
GROUP BY tbAct.MLS, tbAct.Status, tbAct.Address, tbAct.City, tbAct.Area, tbAct.SqFt, tbAct.Level, tbSold.Status, tbSold.Area, tbSold.Level
HAVING (((tbAct.Status)="ACT") AND ((tbAct.City)="TEMPE") AND ((tbSold.Status)="CLOSD") AND ((tbSold.Area)=[tbAct].[Area]) AND ((tbSold.Level)=[tbAct].[Level]));

View 2 Replies View Related







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