Forcing Exact Match In File Search
May 31, 2007
Hi,
Does anyone know how to perform an exact match using file search. The code I have below searches for the users AcroRd32.exe file (I have done it this way to allow for different versions of the reader). The problem is that foundfiles returns also AcroRd32info.exe ie FoundFiles(1). i only want to search for the prior!
Set fs = Application.FileSearch
With fs
.NewSearch
.LookIn = "C:Program FilesAdobe"
.SearchSubFolders = True
.FileName = "AcroRd32.exe"
If .Execute > 0 Then 'check if there is such a file
stAppName = .FoundFiles(1) 'then define this as the applicate string name
stAppName = stAppName & " " 'append a space or file string not correct
'specify path name for location of file.pdf
stlocation = GetPrivateProfileString32("C:WINDOWSSSI_PROGRS_DATABASE.ini", "DIR", "DATABASE_FILELOCATION")
stpathname = stlocation & "file.pdf"
Shell stAppName & stpathname, vbMaximizedFocus
Else
'if no file is found then need to instruct user to install reader
MsgBox "You need to install Adobe Acrobat Reader to open this file", vbExclamation
End If
End With
Cheers to any help..
Tania
View Replies
ADVERTISEMENT
Jun 17, 2005
How can I get an exact match in a search. If I search for say C1 I get results showing everything with C1 i.e C1, C11, C12, C13 etc. I just want to show C1's
This shows my query at present.
Like [Forms]![Search]![BoxNo] & "*"
View 4 Replies
View Related
Sep 3, 2005
Background:
I have a database that keeps track of containers -what they belong to, and what is in them. Each container has a “Call #” which is labeled on the container and is a primary key in the database. The “Call #” field is set to only allow 5 characters in this field. A standard “Call #” for example is "A 152".
When a new container comes into the system, which has not been physically labeled yet, I enter it in the database a little different. So let us say container "A 152" just came in, and has not been physically labeled yet. I enter the “Call #” into the system as "MA152". The "M" tell me it still needs to be physically labeled.
When I go to label all the unlabeled containers, I print a report with all the "Call #''s that start with "M".
I have another field in the same table called "Mark". In my forms I can then go through and click a "Mark Button". The Report prints all containers where the "Mark" field = yes(True). This feature is used for a number of different reports, not just unlabeled containers. To keep the database clean and in order, all “Mark” fields reset to no(false) whenever it opens up.
Because, I used the “Mark” field for other reports, simply clicking the “Mark Button” when I enter the new container into the system will not work.
My Question:
Is There a way to have a Query search for the first letter in a field. So when I go to print my report, a query runs looking for all "Call #s" that start with the letter “M”.
View 2 Replies
View Related
Apr 3, 2008
Hi all
I'm using an array with the Instr function. The array (or the Instr function) doesn't seem to be case sensitive... which is a pain because its picking words within words where the case doesn't match!! I'd like the vales in the array to match exactly when using the Instr function
Any idea how I can get around this??
Thanks
Damon
View 3 Replies
View Related
Oct 8, 2007
Hello,
i'm not sure how to write a query, maybe it'll take VBA function to accomplish this, but I need to display the results for all invoices for an item.
Little background:
1. This set of invoices are of only one particular product line as it's this product line that needs this special handling. These are Guitar orders.
2. Each guitar item can have option items on the same invoice. So basically these are all considered item numbers.
3. The guitar starts as the bare / basic guitar. The customer can choose to select one or many options for a custom guitar.
4. These orders will need to have special guitar programming codes that need to be entered into their guitar programming machines. Call these "Codes".
5. Depending on the option items for the various guitar items, the Codes could vary.
6. Need to be able to display ONLY the Codes specific to the guitar or guitar and option combinations.
I have several tables:
1. Guitar for all the guitar items
2. Options for all the option items
3. ProgrammingCodes for all the programming Codes
4. ProgramCodes for creating the above combinations with a field named ComboID.
5. GuitarHeader - the invoice number and guitar item
6. GuitarDetails - the invoice number and option item (invoice number to invoicenumber link to the GuitarHeader)
Then there's a main form and a sub-form for the end-user (guitar programmer).
1. The main form is the Guitar items
2. The sub-form is the ProgramCodes fields
this form is used for this end-user select the Guitar and options (where necessary) and select the Codes and enter the ComboID for all.
for instance:
These are all the possible codes for AE185.
AND depending on the Options selected for AE185 on invoices, the Codes will differ.
The ComboID is the differentiator.
Code:GuitarOptionCodeComboIDAE185 185RR 1AE185 186RHT1AE185 187RT 1AE18538185RR2AE18538186RHT2AE18538187RT382AE185BB185RR3AE185BB186RHT3AE185BB188RT-B3AE18538185RR4AE185BB185RR4AE18538186RHT4AE185BB186RHT4AE18538188RT38B 4AE185BB188RT38B 4
so for the Codes that repeats in the ComboID is only because the Option(s) also requires that Code as well as the other Codes.
for instance, if the invoice ONLY has Option 38 from the Options defined for Codes, then the result would be:
Code:AE18538185RR2AE18538186RHT2AE18538187RT382AE185BB185RR3AE185BB186RHT3AE185BB188RT-B3AE18538185RR4AE185BB185RR4AE18538186RHT4AE185BB186RHT4AE18538188RT38B4AE185BB188RT38B4
Code:Invoice Guitar Codes123456 AE185 185RR 186RHT 187RT38 <-- say this invoice had Option 38 that was the only match234567 AE185 185RR 186RHT 188RT-B <-- because BB was the only one that matches345678 AE185 185RR 186RHT 188RT38B <-- because both 38 & BB matches
So guess the question is how do I write a query or function (VBA) to be used in a query to get the results for ONLY the matching options so the correct codes for just these options are displaying?
It's difficult to me in figuring that out. how to make sure that the result does not show the ALL the codes that match but ONLY the codes in the combinations. Again, hence the reason why I got to the point of having Combination IDs to differentiate that.
hope I made sense here. Not sure how else to ask the question other then to try and provide examples
let me know how else to explain if this is not helping.
View 5 Replies
View Related
May 28, 2014
there are certain txt boxes that once filled out, will filter a subform of a table of 1000's of records to give them a number to use on the form around 200 of the records have a depot in the "depot" field on the table, when they input a depot, it filters to them 200 fine if a depot is there,
what i want is, when they input the depot, if its there, filter it, if its not, to do nothing, as they could still get a unique number if the depot isnt in the list what happens now is, if the depot isnt in the list, it displays no records
Field : Fld_Depot
Table : Tbl_Agreement_Summary
Show : False
Criteria : Like "*" & SearchForText([Forms]![Frm_New_Accounts]![Fld_Depot]) & "*"
Or : Is Null
View 2 Replies
View Related
Oct 12, 2013
How to find an exact match in a Access DB table using Sql Query in VB6 ?I know that "Like" keyword will give out all those rows which contain the search-for-string. But I want exact match.
View 4 Replies
View Related
Apr 17, 2007
Ok, i have a search query as follows
SELECT Table1.*, Table1.[Winning Contractor]
FROM Table1
WHERE (((Table1.[Winning Contractor])=[Who was the winning bidder?]));
This works well except if the user doesn't captialize a letter or doesn't type in the full company name. Is there a way to change this search to a like search instead of an exact one?
View 6 Replies
View Related
Jul 4, 2014
I did export the table data into a tabbed delimited format and will include that at the end. If you want to reproduce my bug copy that data in a txt file and import that into the table tblMain. Make a search form and a sub form. the sub form is linked to the table and the main form is unbound with two search buttons.
Problem Statement:The code works fine. I did find a bug that seems to arise with the wild cards when the entire field values are entered. You can replicate the bug by testing the search criteria listed below.
This is a brief example of the bug. A detailed description is near the code below.
If my name is "Devtycoon" and I search "Dev" the SQL statement will build "*Dev*" and it will pull up my name, "Devtycoon". On the contrary if I search "Tycoon" the SQL statement will build "*tycoon*" and it will pull up my name, "Devtycoon". If i search "DevTycoon" the sql statement will build "*Devtycoon*" and no results will be returned. That is buggy because the name is in the database but no wildcards would be needed.
Table structure:
tblMain
ClientID
Surname [text]
Organization [text]
ProgramTitle [text]
City [text]
State[text]
Zip4 [text]
Telephone [text]
Form1 contains the controls for search criteria. Three text box controls are used to filter a sub form control called "DS". The sub form is called sFrmMain and is a datasheet that shows results of the search. there is a button that runs the code and another button that clears search criteria and shows all records. Both button's code set the sub form's record source using an SQL string built using a function that returns a segment of the overall search string using the contents of each control that then is concatenated into a SQL statement used to set the record source.
There is a function for the following components of the SQL statement
SELECT / FROM
WHERE
controlA = me.txtSurname
controlB = me.txtOrganization
controlC = me.txtProgramTitle
This is how you can replicate the bug.
I tested two additional surnames organizations and program titles as follows:
Try example (1). you will get both the 4's and the 14's records returned.
If you type in letter for letter of the second record (the one with the 14's) no records populate. It is like the wild card does not like it if you type in the entire field value. Uncle Gizmo's and Allen Brown's method do the same thing were no records populate if the 14's entire surname organization and program title are entered into the text controls. Can you reproduce this error? Other than that I think either method is bulletproof.
Example criteria
1) put the following criteria in each control then hit the search button
4 surname
4 organization
4 program title
[two records returned]
2) put the following criteria in each control then hit the search button
[no records returned]
14 surname 14
14 organization 14
14 program title 14
Code behind search form:
Code:
Option Compare Database
Option Explicit
Private Sub cmdShowallRecords_Click()
Dim strSQL0 As String
Me.txtOrganization = ""
Me.txtProgramTitle = ""
Me.txtSurName = ""
strSQL0 = fSQL_SelectFrom & fWhere & fSurName & fOrganization & fProgramTitle
Me.DS.Form.RecordSource = Left(strSQL0, Len(strSQL0) - 5) & ")"
[code]....
View 12 Replies
View Related
Mar 19, 2014
We're trying to create a database to read quotes from a system based on changes made to components.
We have the database set up to store the quotes happily. We're pleased with the input forms and data capture however we are struggling with a query to get useful data from the database.
I have a main quote data table listing all the required fields such as costs and supplier data for the quotes, a table storing components that may be changed as part of a quote and a table listing alterations that could be made to these components. Each quote could have a number of changes made to a number of components. All these changes are stored in a changes made table which lists the quoteID, ComponentID being changed and The AlterationID of the alteration being made.
I want to be able to input a varied amount of changes via a form and be shown a list of all quotes where at least one change matches. I've managed to get this far using a lot of OR statements however the complexity is introduced as we need to sort these by an extra column produced by the query displaying the percentage the changes made in the quote match the search input.
If a quote appears matches my changes and there are no other changes on the quote - (100%)
If a quote matches all changes I have input but I input 5 changes and the quote has 6 - (5/6 - 83%)
If I input 1 change and a quote matches but has 8 changes on the quote - (1/8 12.5%)
View 2 Replies
View Related
Jun 13, 2013
I am trying to add up a list of dates that match a criteria... a search box result.
I have tried DCount, and now I'm doing it through SQL, and no matter what combinations I try I still get an error - usually 3075 - Syntax error (missing operator)
But I can't find anything missing - I copy the SQL into a query view and it works perfectly... but it won't work on its own. And I've tried using DCount with the query as a query object, and I get the same error.
Code:
Dim ResultCount As Long
Dim DateSearch As Date
Dim MyDate As String
Dim MyDateAdd As Date
Dim varReturnValue As Variant
[Code] .....
I've used the >= And < option as it solves an issue with Date Time. What operator is missing!?
View 5 Replies
View Related
Nov 2, 2005
I have a form that imports an excel spreadsheet and manipulates the data into a database friendly format. My issue is that I have hard coded the test file name in the DoCmd.TransferSpreadsheet command.
What I would like to do is to allow the end user to go and click on the file and then have access pick up the file name and run the process. Is there some Active X control that allows the user to go search for the file they want to import? If so, is there any functionality to such a tool whereas I can have the user click on the file and instead of opening it, I can simply capture the file name to use in my module?
OR… does anyone have a better idea of how I might go about what I am trying to accomplish? I hope I explained my situation clearly enough…
Thanks
Gary
View 3 Replies
View Related
Feb 29, 2008
Hey all,
Tables
ProductsProductBrandSize
PurchaseDetailProductPriceQuantity
Forms
frmFoodSub
Combo BoxesiProductiBrand
TextboxsiSizeiQuantityiPrice
For a couple of days now I've been trying to devise a way to achieve what I want, but I just keep going in circles and hitting errors (thanks to forum members, I've been able to solve most of them.) So, here's what I want to be able to do:
Input a product using the iproduct combo box (which gets its list of values from the Products table); its brand, using the ibrand combo box; and its size using the isize textbox, all in the frmFoodSub form. I then want it to check to see if an exact record already exists (ie. the same product, same brand, same size.)
If it doesn't exist, I want to create it. If it does, I want to do nothing. Then I want the product - either the one I just created, or from a record that already exists matching the iProduct input - to be input into the product field of the PurchaseDetails table. I then want to use iQuantity and iPrice textboxs, already linked to the PurchaseDetails table, to input the newly added product's quantity and price.
I hope my explanation was clear enough. I'd appreciate any help with this you may be able to offer.
View 9 Replies
View Related
Dec 5, 2013
Database to query. It holds tables for the machines we have and the parts each machine requires. We also have a database of spare machines and the parts that are in them.
Given the nature of the machines, some parts aren't worth trying to pull out singularly, only as part of a set.
I've been asked to put together something queries which of our old parts/machines can be reused.
So I have a table of current machines and their parts and when they were last replaced.
I have a query that says 'Show me all the machines that have parts over 5 years old.' I get a list of machines and their parts
Can I then take that whole list of parts and search the table of spare machines any parts and find that exact list of parts?
I don't mind if the machine has more parts, but it must match that exact set of parts and that set of parts should be contained in one machine.
I've added an example that is a cut down version of what I have:
Basically say we might want to replace the parts in Current machine 10002.
I query CurrentMachines for which parts it has.I then want to use the results of that to query the spares. But I only want to return spares that has all three parts that machine 10002 has.
All I can make it do at the minute is find the spares with any one of the parts that match the 10002 list.
View 13 Replies
View Related
May 24, 2013
I have search the web and came across something pretty similar to what am looking for (URL...), unfortunately this database sample does not work with my Access 03, so I cant really play with it.
What I want to do is have 3-4 Paths save on my form to folders on our office server, this is were we keep client files. I like to have the ability to search for individual folders by either client ID or name or even partial name if possible too, knowing that it may display more than one folder for the employee to pick and open.
I have included a picture of the form ...
View 2 Replies
View Related
Jul 7, 2014
I don't seem to find any query formula in the forum where the age changes on the date of birth. I tried all the once I could find but all of them seem to calculate the age as of 1 January. I find it a bit strange that it doesn't work.
I got BirthDate and Date in the table I want to update the age column back in the history with an update query.
Code:
Int(DateDiff("yyyy",[BirthDate],[Date]))
Code:
Int(DateDiff("d", [BirthDate], DateSerial(DatePart("yyyy,[Date]), 1, 1))/365.25)
Code:
Int(DateDiff("yyyy",[Birthdate],[Date]))+Int(Format([Date],"mmdd")<Format([Birthdate],"mmdd"))
All the above change the age on January 1. It's not a train smash but weird.
View 14 Replies
View Related
Apr 2, 2012
I've a company database with everyone's software license but it doesn't have their employee ID number. I have another database with everyone's ID Number and I need to merge the two, How ever the problem is the names aren't exactly the same in both data bases. Some have small changes like
John, Sargent M :: John, Sargent M.
Samantha, Williams Anne :: Samantha, Williams A.
It's all the people with more than 2 names entered that his problem happens the most and I was wondering how to solve this in access?
View 4 Replies
View Related
Apr 13, 2006
I have a quick query question. I have a table that lists employees and workcodes and time spent at the workcode, by date. There are multiple workcodes and I'm trying to create a query that lists each employee and total time spent in each workcode. The poblem I'm having is this: Unless the agent spent time in all the workcodes, he doesn't show up on the query.
For instance: Agent A, spent 200 minutes in Code A, 220 minutes in Code B, and 10 minutes in Code C. Agent A shows up fine in the query. Agent B, though, spent all 430 minutes in Code A. He doesn't show up at all.
I think it's also worth mentioning the format the information comes to me in. It's an Excel file broken up into 4 columns, Date, Agent, Code, and Duration. As much as I would like it to be Date, Agent, Code A, Code B, ect, I have no control or say in its format.
Any help or ideas would be greatly appreciated.
View 1 Replies
View Related
Apr 25, 2007
Hi, I have a command button that opens a pdf file. However i will be distributing the database as a runtime package and need to account for people having different versions of adobe reader so need to search for the filepath string where Acord32.exe is found. This is the code I have but I am stuck! Ay help aprpeciated!
Private Sub Command4_Click()
Dim stAppName As String
Dim stPathName As String
Dim fs As Object
Set fs = Application.FileSearch
With fs
.LookIn = "C:Program Files"
.SearchSubFolders = True
.FileName = "AcroRd32.exe"
.Execute
????? stAppName = .FoundFiles
Set fs = Nothing
End With
'specify path name for version of adobe acrord32.exe
'stAppName = "C:Program FilesAdobeReader 8.0ReaderAcroRd32.exe "
stPathName = GetIniSetting("C:WINDOWSSSI_DL3_PROGRS.ini", "DIR", "REPORT_FILELOCATION") & "HOOF.pdf"
Shell stAppName & stPathName, vbMaximizedFocus
End Sub
View 1 Replies
View Related
Aug 15, 2013
How to write some code that will search a known drive and folder structure for a tif file and on finding it, open that tif file.
The known drive/folder structure is as follows:
M:CustomerSatisfactionStdDGImages
or it could have the full path as follows:
prdfs01QUESTIONSCustomerSatisfactionStdDGImag es
and then there are the following folders which contain any number of tif images:
01_Q
02_Q
03_Q
04_Q
05_Q
06_Q
07_Q
10_Q
11_Q
12_Q
13_Q
14_Q
17_Q
18_Q
19_Q
20_Q
21_Q
23_Q
24_Q
28_Q
29_Q
30_Q
31_Q
32_Q
33_Q
34_Q
35_Q
36_Q
37_Q
38_Q
39_Q
AR_Q
HE_Q
SKY_SKY3B
I would like to have a button in a form that the end user clicks and they then enter the name of the tif file they are looking for and on pressing enter the file is searched for and if found it is automatically opened up for them to see, if it is not found then a message "File Not Found" is displayed.
I Believe that I will need something like this:
Code:
Dim FS As FileSystemObject
Dim filenum As Integer
Dim tmp As String
Dim Folder As Folder
Dim subFolder As Folder
Dim File As File
[Code] .....
It's when I get to this point that I've got stuck, I don't know how to structure the code required to do the search and on finding the tif file open it.
An example tif file I might search for is: 0H214_2CJ0001905.tif.
View 11 Replies
View Related
Jan 23, 2006
I have an Access Application that has a simple username/password interface that controls user access.
It can then track who does what and controls access to different screens. Very simple.
One terminal is used by multiple users and they forget to log-out the previous user as it is a Production envirnoment.
Is there a timer that I can add to the App that logs Access off automatically after a period of time??
View 1 Replies
View Related
Jun 26, 2007
So I have a table that does a count on ratings in a certain category. The problem is that I want a number to appear for each of the three categories, even when the count returns nothing. In other words, we have 3 rating types, "poor, good, and great," and I need a result for it, even if no one gave the category a poor rating. Now I figured that if I created a table (tblCateg) that just held the three categories (sCatDesc) and did a join on the other table (Ratings) with the column (IN_Category) that I needed, it would force the query to make all 3 ratings appear and a count for each. Unfortunately, this didn't happen. All that appeared was
---------
Great 17
Good 7
---------
I figure the query is just seeing the count for the Poor rating as a Null rather than a 0; anyone know how I can force it to see it as a 0 instead?
Here's the query I'm using:
SELECT tblCateg.sCatDesc, Count(Ratings.IN_Category) AS CountOfIN_Category
FROM tblCateg LEFT JOIN Ratings ON tblCateg.sCatDesc = Ratings.IN_Category
WHERE (((Ratings.RatingDT) Between #1/1/2007# And #3/31/2007#))
GROUP BY tblCateg.sCatDesc;
View 9 Replies
View Related
Jan 26, 2006
I have a report button on a form and the form is the way of inputting in to two tables.
I need a way to force the update of the tables before the query that the report is based on, is run.
Is there a command that forces an update of the tables?
Thanks
Peter
View 9 Replies
View Related
Apr 4, 2008
I'm having a problem with my database filesize getting larger with the more searches i do. At first i couldn't figure out how it was getting so big, but then i tried a few things and came to the conclusion that every time i do a search it increases its filezile.what made me notice this at first is that the file size of the original copy of my db is 13MB, but if i Save As a different name, like Assets_Backup, then the size of the new file is only 2MB, and after i do some searches it increases again.here is a file with just my search form and search query so you can see the code for them. i removed everything else to shrink the file down, which also made the search form not function properly, but i thought the design and code might be enough.is there something that i can change to keep it from remembering every search?thanks for any help.--------------------after searching the topic a bit more i've found that compacting the database will shrink it down to 2MB, but is this something that will have to be done on a regular basis, or is there a way for it to do it on its own?
View 5 Replies
View Related
Feb 28, 2014
Previously in Excel / Access 97 / 2003 I made a little tool that would search for files in specified locations - I modified the code so that it would search for files based on what was entered in cells.
I believe a lot of the old code doesn't work in Access 2010 and it seems like a lot of the old file searching code I used to use no longer works.
Is there code available that searches a directory and lists results?
View 1 Replies
View Related
Feb 23, 2006
Hi
I have a simple database where I wish to force only Upper Case text even if user inputs Lower Case text, how can I do this?
ViRi
View 5 Replies
View Related