Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Wildcard In VB6?


anyway?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Wildcard Before/after
This is probably an easy thing, but I am trying to insert an IF statement Formula to look for the word TOTAL. I would like to insert a wildcard before and after the word TOTAL, so that it pulls anything associated with that word? How do I do that.

=IF($E7="*TOTAL*",M7,0)

Can A Wildcard Be Used Here?
Ok, here is the deal. Is there a way to impliment a wildcard character to reduce the code down to a realisic level? I just need to know if the root of a drive is selected. The following code works perfectly, it just comes of as a bit inefficient. Don't you think?


Else
If Fldr = "C:" Or Fldr = "D:" Or Fldr = "E:" Or Fldr = "F:" Or Fldr = "G:" Or Fldr = "H:" Or Fldr = "I:" Or Fldr = "J:" Or Fldr = "K:" Or Fldr = "L:" Or Fldr = "M:" Or Fldr = "N:" Or Fldr = "O:" Or Fldr = "P:" Or Fldr = "Q:" Or Fldr = "R:" Or Fldr = "S:" Or Fldr = "T:" Or Fldr = "U:" Or Fldr = "V:" Or Fldr = "W:" Or Fldr = "X:" Or Fldr = "Y:" Or Fldr = "Z:" Then
TxtDest = Fldr & FlNam & Typ
Else: TxtDest = Fldr & "" & FlNam & Typ
End If

Thank you in advance for any helpful suggestions.
Chris

Wildcard
Im trying to create a wildcard search. Basically at the mo i have this...

If Text1.Text = rs.Fields(Variable) Then

Which is gay cause you need to add the exact information.

how can i make so its like (i know its not)

If Text1.Text "Which is like" rs.Fields(Variable) Then

so for example if in the database theres a record called Christine
I want to be able to search for chr (notice case) it will find Christine.

* As NOT A Wildcard
I want to search for a * as a criteria in a field but I don't want it to be read as a wildcard character. How is this done?

thanks a lot, cornbread

Help With Wildcard
I hope I'm posting this in the right section, all I know about this stuff is the little bit I've learned trying to do this. I tried a search and didn't find anything that I recognized as being the same thing.

I'm having a problem with editing macros in a customer-service program called DMS (if that means anything to anyone). Here's the relevant part of the code:

---------------
.StatusBar = "Waiting for Prompt: Part No:"
.WaitForString "J" & ESC & "[3;17f", NEVER_TIME_OUT, rcAllowKeystrokes
.StatusBar = ""
.Paste

.StatusBar = "Waiting for Prompt: Part No:"
.WaitForString "J" & ESC & "[3;17f", NEVER_TIME_OUT, rcAllowKeystrokes
.StatusBar = ""
.Transmit CR

.StatusBar = "Waiting for Prompt: Part No: Date From:"
.WaitForString "m" & ESC & "[3;71f", NEVER_TIME_OUT, rcAllowKeystrokes
.StatusBar = ""
.Transmit CR
-------------------------

Now, the problem comes after "Paste." Where it says "StatusBar =" is the prompt it expects to see before the next action of "Transmit CR." The problem, as far as I can tell, is that what is pasted will not always be the same thing. I need either something that works as a wildcard or a way to get it to ignore what's there and send a **** CARRIAGE RETURN.

Any help is greatly appreciated; keep in mind I don't know anything about this stuff.

WildCard
How to check wheather a charcters entered in a text box is wild card or not?

Use Wildcard?
anyone know how to implement wildcards when the user is doing find/replace in a text or richtextbox

DAO Wildcard
I have this SQL line to open my recordset...from a DAO database


rcsTest.Open "SELECT ProjectName FROM Utfall Where " _
& "ProjectName Like '" & cboProjekt.Text & "*" ' GROUP BY ProjectName;", _
conProjektdatabas, adOpenStatic, adLockReadOnly

But it doesn't work..
I want the recordset to have all the projects in projektname that starts with the letter I have written in cboProjekt.text

I get a strange error that the operation is not allowed on an object referencing a closed or invalid connection

Wildcard
whats the vb wild card, like in a windows shell its *, like apple.* would find apple with all extensions, whats the one in vb, i used


Code:
If InStr(1, Strdata2, * & "change") Then


but that isnt working for whenever it receives anything with change as the last character

How Can I Wildcard This PLEASE HELP
how can i wildcard this to always go to c: est

instead of
Open "c: est emp.zip For Binary Access _
Write As #1
Put #1, , b()
Close #1
MsgBox "Done"

I need something like this

Open "c: est" & "*.htm" For Binary Access _
Write As #1
Put #1, , b()
Close #1
MsgBox "Done"

so at the end of my
download i have
msdn1.htm in c: est


heres my code

Inet1.AccessType = icUseDefault
Dim b() As Byte
Dim strURL As String

' Presuming this is still a valid URL.
strURL = "http://msdn.microsoft.com/library/welcome/dsmsdn/msdn1.htm"

' Retrieve the file as a byte array.
b() = Inet1.OpenURL(strURL, icByteArray)



Open "c: est" & "*" For Binary Access _
Write As #1
Put #1, , b()
Close #1

Wildcard SQL
Hi

I have an application that builds up criteria from form controls and then when the user has selected all of the criteria, they press an execute button and the SQL gets fired off against my database.  It works well apart from one of my selections.

I have a wildcard facility to select product groups.  Each product group is built up from 3 numbers.  i.e. ‘324’ ‘534’ ‘544’, etc.  The way it works at the minute is the user enters the criteria in a text box.  It sort of works but not the way I want it to.

I want the users to be able to type ‘%2%’ which will return any product group where the middle number is a 2 (i.e. ‘123’ ‘526’, etc.)  At the minute it will return all product group numbers with a 2 in the number including numbers that start or end with 2.

Is there a way to do this with SQL?

Here’s my code

SQL = "SELECT DISTINCT `Part No`, Description, `Invoice No`, . ETC. FROM blah WHERE blah, ETC.

If Not txtWildcard.Text = "" Then
    SQL = SQL + " AND `Product Group` LIKE '" & txtWildcard.Text & "'"
End If

SQL = SQL + “ORDER BY…ETC”

Any pointers would be appreciated

Thanks


VB Wildcard?
I have some code that parses a folder for a filename I choose such as "12345.jpg" I would like to be able to name the file "12345-A.jpg" yet have the program just ignore everything after the "-" including ignoring the dash itself.

Here is my current code...

Code:
   For Each CurFile In DataFiles
        If Not CurFile.FoundInImport Then
            OutdatedList.AddItem CurFile.FileName & "." & CurFile.Extension
            If FSO.FileExists(OldDirectory.Text & CurFile.FileName & "." & CurFile.Extension) Then
                FSO.DeleteFile OldDirectory.Text & CurFile.FileName & "." & CurFile.Extension
            End If
            FSO.MoveFile CurFile.FullName, OldDirectory.Text & CurFile.FileName & "." & CurFile.Extension
            OutFile.WriteLine "Outdated file: " & CurFile.FullName & ", moved to " & OldDirectory.Text & _
                CurFile.FileName & "." & CurFile.Extension
        End If
    Next CurFile


Thanks for any help



Edited by - Matrix1000 on 7/29/2003 9:55:09 AM

Using Wildcard In VB
Hi,
     I want to use wildcard in VB . But this is not a part os SQL query. I want to use something like this to set bookmark:

Dim Str As String
Str = "Hello"
If (ppdRecordSet.Fields(2) Like "& Str" )Then
     
DataGrid.SelBookmarks.Add ppdRecordSet.Bookmark
 
End If


How do I pass Str to Like operator.

Please advice.

Thanks,
DK

Using Wildcard
Hi,

I have a word file that holds student information in a specific format.

<my_stud_name>Bob Dylan
<my_stud_age>60
<my_stud_dob>1-10-1945
<my_stud_add>12 abc def
<my_stud_objective>To be an artist and also to get a vba app runing properly

i have a multi-page document with more data like this. I want to convert this into an xml file with my tags specifications. (Using VBA or VB)

<xml_s_name>Bob Dylan</xml_s_name>
<xml_s_age>60</xml_s_age>
<xml_s_dob>1-10-1945</xml_s_dob>
<xml_s_add>12 abc def</xml_s_add>
<xml_s_objective>To be an artist and also to get a vba app runing properly</xml_s_objective>

i used a straight forward replacement function and was able to replace all the basic tags into my xml tags and now my current document looks like this

<xml_s_name>Bob Dylan
<xml_s_age>60
<xml_s_dob>1-10-1945
<xml_s_add>12 abc def

Then thought of using wildcards.

Since every statement ends with a carriage return and the next tag stats on the next line, it allows me to look for patterns and place my end tags also.

For example if i hit find and replace (choose to use wildcards) and then post

Find: <xml_s_name>(*)^13

It fetches all such instances. Now i have no idea of how to write a function for this. so that it takes the source
and replace it with source + destination.
so it looks like

<xml_s_name>Bob dylan</xml_s_name>

Hope You can Help!. If using wildcards is not a good idea, the please suggest an alternate solution. I am new to VB and VBA so any help would be appreciated

Thanks in advance.

PS: IF i am not clear...let me know and i'll put a better description

Delete Row With Wildcard
Hi there, I'm trying to create a macro that looks at a value in column A, lets take three examples

A

18-333-32
18-333-32L
18-333-32F

It's like that with thousands of different numbers, but there is always a number, then the number with an L and the number with a F. I wish to search and delete the rows that contain the L and F numbers. The numbers are not a fixed lenth, it could look like 15-33333-3233. So, I'm trying to play with wildcards, but I'm not reaching much luck.

Thanks in advance!

Wildcard Searches
ok heres my problem. i have a markbook where everyone has a membership number in column b. This is offset by -1 on the row headings because row one contains titles. i have already found how to pull out a name from the sheet by entering the number, and also mark them off in a set column. I also found out last night how to search by name and get the membership number.

The only thing i haven't managed to do yet is get partial matches on names, it must be exact or it falls apart. I've included both codes below, so hopefully it should help you see what i am trying to do:

here is the original form to mark people in (i know there are some extra bits in the code that don't need to be there but i cant be bothered taking out)


Code:
Private Sub commandbutton4_click()
UserForm2.Show
End Sub
Private Sub CommandButton1_Click()
Dim memnum As Integer
Dim mark As String
memnum = Val(TextBox1) + 1
mark = TextBox2 & memnum
Range(mark).Select
ActiveCell.FormulaR1C1 = "X"
End Sub

Private Sub CommandButton2_Click()
Dim memnum As Integer
Dim mark As String
memnum = Val(TextBox1) + 1
mark = TextBox2 & memnum
Range(mark).Select
ActiveCell.FormulaR1C1 = ""
End Sub

Private Sub CommandButton3_Click()
Unload Me
End Sub

and here is the second code which searched for exact matches to textbox1 (i am mainly after how to search upper and lowercase but if anyone can get it to do partial matches aswell i will be greatful)


Code:
Private Sub CommandButton1_Click()
Dim num As Integer
Dim memnum As Integer

Do While num < Val(TextBox3)
num = num + "1"
ran = "A" & num
Range(ran).Select

If ActiveCell.FormulaR1C1 = TextBox1 Then
memnum = num
memran = "B" & memnum
Range(memran).Select
UserForm1.TextBox1 = ActiveCell.FormulaR1C1
Unload Me
End If
Loop
End Sub

the idea of the whole thing being, someone walks in, doesn't know their number so you click on number finder (on form1) then enter their name on form2, it finds it, puts it into the member number box on form1 and then form2 closes.

i hope that all made sense anyway

thanks

paul

Wildcard Replace
Hi,

I have a series of cells that I need to replace a character and all the characters to the right of it with another character

ie 1234/1234 would become 1234_

I have the code to do the the initial replace of the "/" but don't know how to go about removing the rest.

Any help would be greatly appreciated.


Code:
Replace(Range("B2").Value, "/", "_")

Wildcard Question
Hello,

I would like to write vb code to access a cell (A1) in a spreadsheet and detect if anything other than an integer value is present.

Currently, my code prompts the user to enter a number in a dialogue box and this value is copied to cell A1.

As a quality control I would like write code that will detect if a letter or character other than an integer has been entered in cell A1. However i'm not sure how to do this and would greatly appreciate any help.

My code looks like;

Range("A1").Select
TheNAME = InputBox("Please enter your current inventory.", "Inventory")
ActiveCell.Value = TheNAME
Range("A2").Select

Thanks.

Wildcard Searching
Ive asked about this before, and got a good peice of code which compairs the first part of the 2 strings, now i need code which will seperate search words and also find those words within words. For example in my database i might have this.

MGB BUMPER RUBBER

I want the user to be able to type in "Bumper MG" and get the above record.

Currently im using

If (InStr(1, UCase(rs.Fields("desc")), UCase(Text1.Text))) = "1" Then

Which only works if you type in the first part of the record.

Wildcard Search.
Hi
Im trying to make a wildcard search. I did it before in a previous project, which unfortunatly ive lost half the sourcecode for, according to my documentation i used this to search.

(InStr(1, UCase(rs.Fields(FirstName)), UCase(txtFName)))

But i have no idea how to use it. Any ideas?

I tried....


Code:
If rs("suppliername") = (InStr(1, UCase(rs.Fields("suppliername")), UCase(Text1.Text))) Then
MsgBox "BINGO!"
End If

It didnt return any results.

Wildcard And MySQL
I am converting over to mySQL from Access 2.0 and I am having a little trouble with a query. Here it is:


Code:
SELECT Max(WBS) AS LastOfWBS FROM Projects Where((WBS)) Like """ & txtEntryData(0).Text & "#%"";
I am trying to get the last WBS ID starting with a particular letter the user will type in the textbox. My criteria is that it has to start with a letter and the next character is a number. There can be letters or more numbers to the right of the first number. For example: A01C or B001, but not AB01. In Access we could use the following query:


Code:
SELECT DISTINCT Max([Projects].[WBS]) AS LastOfWBS
FROM Projects where (Projects.WBS) Like """ & txtEntryData(0).Text & "#*"";
How can I insure when using mySQL that the second character is a number?

Wildcard &amp; ADO Problem
Can anybody tell me where I am going wrong? When I try to use a wildcard selection in the ADO Data control such as: SELECT * FROM tblCustomerOrders WHERE OrderNumber LIKE '141*' in the Record source, it fails to return any records. If I change it to LIKE '141187' it returns that record.

Could anybody tell me why the wildcard selection does not work in the ADO version, while it is fine on the DAO version or what I might be doing wrong?

Thanks in advance,
Chris

Wildcard Search
Hi I have this code


Code:
Private Sub txtLastName_Change()

Dim conFindCustomer As ADODB.Connection
Dim recsetEditCustomer As ADODB.Recordset
Dim strCustomerID As String
Dim strTitle As String
Dim strFirstName As String
Dim strLastName As String

Set conFindCustomer = New ADODB.Connection
conFindCustomer.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "datadata.mdb;"
conFindCustomer.Open

Set recsetEditCustomer = conFindCustomer.Execute("SELECT CustomerID, Title, FirstName, LastName FROM Customers WHERE LastName='" & Me.txtLastName.Text & "'")

Do Until recsetEditCustomer.EOF
strCustomerID = recsetEditCustomer.Fields.Item("CustomerID").Value
strTitle = recsetEditCustomer.Fields.Item("Title").Value
strFirstName = recsetEditCustomer.Fields.Item("FirstName").Value
strLastName = recsetEditCustomer.Fields.Item("LastName").Value

lstCustomers.AddItem strCustomerID & " - " & strTitle & " - " & strFirstName & " - " & strLastName

recsetEditCustomer.MoveNext
Loop

conFindCustomer.Close


End Sub

This works if i enter the entire last name but i want to be alble to anter "w" into the txtLastName and for it to return "Welch"

Now in Access i would use - Like "W*" - but this wont work in my sql?

Any help would be really welcomed!

Thanks

Searching Using Wildcard
Hi their does anyone know if it is possible to search an access database using a wildcard so that a user can search for the the begginning of a last name thanks

Wildcard With Clock
Hi,

I am trying to make a VB6 program which brings up a message box every minute on the minute.

I have a label displaying time (label.caption = Time), but i'm unsure how (or even if it is possible) to get the program to produce a message box every time the clock reaches XX:XX:00

I have tried various methods including

If label.caption = "*:00"

and other methods, but none have worked.

Can anyone point me in the right direction

Many Thanks

Jordy

Wildcard Querry
Hi

I am very new at programing in VB, so please don't laugh...

I am writting a program with imported Access database file. I want to perform a querry. I have VB 5 express edition. I create a querry with clicking on MyDatabaseTableAdapter then Add Querry...
Then table adapter configuration wizard apears.

What I wanted to perform is to create a querry with Wildcard searc instead of parameter search. I createdi a wildcard search in MS Access but it is not the same here. I want to create such wildcard search that when I write por example "Jer" in the search TextBox And press search button it displays only records with names that include letters jer inside.

I have found some examples on the internet but it still doesn't work.

I hope you understand what I am trying to do and hope someone has the right answer. Please help if you can.

Greetings

IIf Statement With A Wildcard
Hi Guys,
Basically im building a search facility.
I shall be building a string in sql etc..

Basically I want to say or see if this is possible.

The fields in the table will hold a value of null, "Y" or "N"

On the search form I will have alot of textboxes and want to say this on each one.

where my database field = IIf([search condition] = "Y", "Y", "*")

what im trying to achieve here is find the ones where they have the Y in - only if the user has specified a yes, and I dont care about the other fields they have left out.

--
I am redoing someone elses work and this is how the tables and forms etc.. are set up


thanks all

Test With Wildcard
Is it possible to use a wildcard with the FSO?

I want to see if any files with .BAK exist in a folder...would this work?


Code:
If objFSO.FileExists("E:*.BAK") Then
...do whatever

Wildcard Read???
I need to read a text file but do not know the extention so the file may be called file.txt or file.doc or what ever the user has saved it too there hard disk after downloading from an email is it possible to read the file using code and refer to the file "file.*" or better still is it possible to send a file for my app to read that cannot be changed in this way ?????

Strings With Wildcard
Can I compare strings with wildcard to another string? Here is what I am doing:

sub main
Dim myClaim2,claim
claim = "33QNATPAUTOY017-05"
myClaim2 = "33QNATPAUTOY017*"
If myClaim2 = claim Then Debug.Print "true" Else Debug.Print "false"
end sub
When I do this, it comes as false. Do I need to just use a str function instead? Or is there a way to get it to compare using the wildcard.

Thanks.

Wildcard List
Hi all,
I want to check whether the entered string in a Text box is valid wildcards(This is used in MS word.If the user selects the Wildcards in the Find and Replace option, Entereing a non wildcard will give messages that invalid wildcard usage.How can I implement this in VB)

String That Contains A Wildcard
The user enter in items numbers. Should the user enter in an (*), I would like to END SUB. How can I check if a string has an (*) in it without VB thinking that I am search all.


VB Code:
If sCCode like chr(042) then End Sub


I've tried this but again VB thinks that I am search all.

Can anyone Help?

Thanks

Wildcard Search
ms access vb 6

im doing this searching form wherein it will search anthing u enter in a txtbox i have this code

str = "select * from tblstud where name like '%" & x & "%'"
If rs.State = 1 Then rs.Close
rs.Open str, conn, adOpenDynamic, adLockPessimistic
ListView1.Visible = True
ListView1.ListItems.Clear

If rs.EOF Then
ListView1.Visible = False
MsgBox "No Record Found"
Else
txtno = rs!no
txtname = IIf(IsNull(rs("Name")), "", rs("Name"))
txtaddress = IIf(IsNull(rs("Address")), "", rs("Address"))
txtage = IIf(IsNull(rs("Age")), "", rs("Age"))
Txtstatus = rs.AbsolutePosition & " of " & rs.RecordCount
End If
End If
Dim i As Integer
For i = 0 To rs.RecordCount - 1
ListView1.ListItems.Add , , rs!no
ListView1.ListItems(ListView1.ListItems.Count).ListSubItems.Add , , rs!Name
ListView1.ListItems(ListView1.ListItems.Count).ListSubItems.Add , , rs!address
ListView1.ListItems(ListView1.ListItems.Count).ListSubItems.Add , , rs!age
rs.MoveNext
Next
'End If
End Sub

Private Sub cmdtotal_Click()
DataReport2.Show
End Sub

Private Sub cmdprevious_Click()
rs.MovePrevious
txtno.Text = rs!no
txtname = rs!Name
txtaddress = rs!address
txtage = rs!age
Txtstatus = rs.AbsolutePosition & " of " & rs.RecordCount
rs.MovePrevious
If rs.BOF Then
cmdprevious.Enabled = False
cmdfirst.Enabled = False
cmdnext.Enabled = True
cmdlast.Enabled = True
rs.MoveNext
ElseIf rs.EOF Then cmdnext.Enabled = True
cmdlast.Enabled = True
Else
rs.MoveNext
cmdnext.Enabled = True
cmdlast.Enabled = True
End If




this code only search for letter and selected spevial characters..special characters like _ and % are not being search what beoing displayed was all the list of records i have..how can i solve it..how can i used escape statement by SQL if ever i use SQL as database..hnx

Numerical Wildcard??
I have a search form where users can input what they know about the record they are searching for.

one of the fields is postcode area.

eg. g, gu, gl etc...

however the database contains some postcode sectors, eg. g16

is there a numerical wildcard i could use to search the database. at the moment i am using "postcode like 'g*'" and it is coming up with g, gu, gl and g16. i don't want the gu, gl i only want the g and the g16.

can anyone help???

thanks

GTJ

Wildcard Exist
hey guys,
this is a simple question but i dont know the answer to it and it is really holding me up.

how could i find whether a type of file exists within a folder? so basically i want to know how i could check the folder for the existence of a file type using a wildcard.

i tried using the same method i would see if a file exists except i would put a wildcard in for the filetitle.

Public Function FExists(OrigFile As String)

Dim fs
Set fs = CreateObject("Scripting.FileSystemObject")
FExists = fs.fileexists(OrigFile)

End Function


Private Sub Command1_Click()

Dim exist as Boolean
exist=FExists("C:*.txt")

End Sub


many thanks to anyone who can tell me how to do this.

Search For Wildcard (*)
How can I set the SQL string (stQuery) to search records like mySTR*? (ex: if I type 300, I want to searh for all records that the field starts with 300...
__________________

Dim stQuery As String

With con
.Provider = "Microsoft.jet.oledb.4.0"
.ConnectionString = "data source=" & dbPath
.Open
End With

strFind = InputBox("Find#:", "Find")

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''
stQuery = "SELECT * FROM myTBL WHERE myTBL.MyField LIKE strFind & "*""
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''

With cmd
Set .ActiveConnection = con
.CommandType = adCmdText
.CommandText = stQuery
End With

With rs
.LockType = adLockPessimistic
.CursorType = adOpenKeyset
.Open cmd
End With

Set Adodc1.Recordset = rs 'load table data to grid
Adodc1.Refresh
rs.Close

thanks

Wildcard With Dates
hi there, does anybody know how to use wildcards with dates?

here's the situation:
i have files in a folder with the filename CLGyyyymmdd.txt where yyyymmdd is a date.

now i want create a function that deletes all the files in the folder where yyyymmdd in CLGyyyymmdd.txt is less than or equal to a given date that is passed into the function.

Wildcard Characters
Hello Everyone-

Is it possible to use wild card characters in visual Basic?
I am passing arguments in through a command line:

If Command$ = "cmdOption" Then
'Do something
End If

In the "cmdOption" part I want to pass in a value that represents n number of days. The problem that I am having is that I don't know how to execute the above code when passing in an argument that isn't static.

Any help would be greatly appreciated. Please let me know if you need more info.

Wildcard Characters
Can someone tell me how wildcards characters would work in a string? IE: "Gim ate <any number> apples"

How would i use wildcard characters in an if statement for example to see if a user entered in that sentence but with any number of apples.

Bad example, but i need to know how they work!

Wildcard Data
I have a VB 6 app with an Access db.  During the search for data a querydef creates a query named filer.  (It filters one table)  If a person searched a filed like name with out a wildcard it results show.  If they add a wildcard at the end of the name, James*, no records show in my ADO.  In the Access "Filter" query I can open it and see the results, but I can not pull them into my app.
CODEdb.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sc & ";Mode=Read;Persist Security Info=False;"
strQ = "SELECT * FROM Filter2"
adoPrimaryRS.Open strQ, db, adOpenForwardOnly, adLockReadOnly

VB Wildcard Search
Hi All

Is there an easy way to modify a SQL statement (Shown below) to include similer matches. EG

The query looks though for a company name (CPL for example) but in the table the company could have spaces in the name C P L.

Can I get the statment to look at the table and ignore the spaces.

The statment is:

    dim Company as String

    Company = txtCompany_Name.Text

        db.Open cCONNECTION_STR1
    rs.Open " SELECT Title, FirstName, Surname, DOB, MaritalStatus," _
        & " ResidentialType, OccupationType, TimeInEmployment, NbrOfCreditCards," _
        & " [House Flat], Street, District, Town, PostCode, TimeAtAddress," _
        & " PrevHouseFlat, PrevStreet, PrevDistrict, PrevTown, PrevPostCode," _
        & " PrevAddressTime, AccountNumber, SortCode, AccountName," _
        & " Tariff, SIM, IMEI, Handset, PAC, VAS1, VAS2, VAS3, VAS4, Advisor," _
        & " Date, [Time Actioned], Decision, id, BranchNo, AssistantCode" _
        & " From Contingency" _
        & " WHERE (((Company)='" & Company & "') AND ((Decision) Is Null));" _
        , db, adOpenStatic, adLockOptimistic

David Lerwill
"If at first you don't succeed go to the pub"

Wildcard In A Filename.
I have been looking through the posts for info on wildcards within a file name.
I have a number of documents (Excel,Word and PDF files)which I need to open from a command button.
They all have one thing in common in that they are named with firstly a Job Number followed by a hyphen and after that a unique combination of alphanumeric charachters. So I have something like this...
JobNo = textbox(11).txt
Filename = JobNo & "-" & "PO452345.PDF"
or
Filename = JobNo & "-" & "MPI.xls"
I just cannot get the syntax correct for a wild card (%) to replace the part after the "-"
Most of what I have read here uses LIKE but I wonder if it is necessary in this simple file name.
Any help would be much appreciated.


Wildcard Searching
I've already got a good peice of code which compairs the first part of the 2 strings, now i need code which will seperate search words and also find those words within words. For example in my database i might have this.

MGB BUMPER RUBBER

I want the user to be able to type in "Bumper MG" and get the above record.

Currently im using

If (InStr(1, UCase(rs.Fields("desc")), UCase(Text1.Text))) = "1" Then

Which only works if you type in the first part of the record.

WildCard Search
I have a richtext box.Now i want to find the string by regular expression.The cursor has to move from charcter by charcter when Findnext button is clicked.How can I?

Use Textbox And Wildcard To Get Directory
Hi all,

I'm trying to use a textbox in combination with (possible) a wildcard to get a path where the user saves his file. In the textbox the user enters a unique projectnumber (always 4 digits).
This projectnumber excists as a folder on a project-drive as "4 digits and a name" eg c:1234getyourwomanonthefloorsubfolder1subfolder2

Is it possible to get the full pathname from only the four digits entered in the textbox without the underlying subfolders???

Thanx in advance

Wildcard Match For Replace?
I am reading a text file in, and need to replace part of a string. The problem is, the string will always be changing. The line is:
MBL [**/**] where * could be any number. I am drawing a complete blank on what to do. I am reading the entire text file into a string, and once I make the change, I want to write the file back out.
Does anyone have any lightning bolts to hit me with?
thanks

Wildcard In Parameter Query
I have a parameter query that searches for names in a table. It recieves two parameters: inputNameFirst and inputNameLast, both of type text.

Currently, I'm not using wildcards, so the input first and last name have to exact. If the user doesn't type it in exactly, you don't get any results.

Example:
For Allan R James,
Search By
First Name: Allan R
Last Name: James
=Results Returned correctly.

First Name: Allan
Last Name: James
=No results returned.

Or in VB

Code:
PARAMETERS inputNameFirst Text (50), inputNameLast Text (50);
SELECT firstName, lastName
FROM Names
WHERE Names.firstName LIKE inputNameFirst
AND Names.lastName LIKE inputNameFirst;

I tried putting wildcards (%) directly after the parameter name like this

Code:
...
WHERE Names.firstName LIKE inputNameFirst%
AND Names.lastName LIKE inputNameFirst%;

I got a syntax error.

Next I tried


Code:
WHERE Names.firstName LIKE inputNameFirst+'%'
AND Names.lastName LIKE inputNameFirst+'%';

But that just plain didn't work.

Any ideas?

Folder Exists Using Wildcard
Hello,

I'm new to VB and working on my first project. I am having troubles trying to work out the code for what I want to do.

I need to firstly check if the folder exists and then if it does I need to return the full path of the folder. The thing that I'm getting stuck on is that the folder name may vary, it will always have the same job number (eg '4999') but will have text after the number and sometimes a prefix before it (eg 'v24999 Project Sun'). I was wondering if there is a way I could use a wildcard for this (eg '*4999*') and then return actual path so that I am able to save the active workbook in this folder?

This is the code I have been working on and will reurn the path of the folder but does not allow for wildcards:

Sub ShowFolderInfo()
folderspec = "C:JobsAdhoc4999"
Dim fs, f, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec)
s = f.Path
MsgBox s
End Sub

Any Ideas on how I could achieve this?

Thanks in advance,

Ogopogo

Wildcard In Application.GetOpenFilename
I've run into an inconsistency between the way 'file finding' wildcards work in Windows ( e.g. SEARCH ) and in VBA. I'd like to be able to filter the files found to present the user with a very specific set of files - only the ones that match a particular structure.


suppose I want to find all the files that start with AAA, the filename ends with BBB, and the extension is CCC. That is, every file I want found starts with the same prefix, ends with the same suffix, and has the same extension.

I'd like to use a filter like : AAA*BBB.CCC

when one does a Windows Search, this search string works fine and gives the following results
AAA_one_BBB.CCC
AAA_another_BBB.CCC
and so on

ON THE OTHER HAND, in VBA, using Application.GetOpenFilename
the same file filter finds the following files :

AAA_one_BBB.CCC ' correct, I wanted this one
AAA_another_BBB.CCC ' correct, I also wanted this one
xAA_something_BBB.CCC ' INCORRECT - the prefix is wrong
AAA_morethings_BBx.CCC ' INCORRECT - the suffix is wrong


can anybody tell me whether :
A - yes, that's the way it works , and tough cookies that it's different from SEARCH
B - no dummy, you need to code it differently

thanks for your help

regards
woody

Copyright 2005-08 www.BigResource.com, All rights reserved