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

Instr Wildcard -RESOLVED

Hello guys, I'm trying to find out if theres any way to use a wildcard in the instr function. Or comparing any two strings in anyway really.

Say for instance I wanted to parse a log file that would have a line in it like (this is totally made up out of my head btw hehe)
Susan told Mike to go to the Zoo.

and when parsing I want to look for all lines that match

* told * to go to the *

So is there any wildcard characters usable when comparing strings or does anyone know of another way to accomplish this?

Thanks for any help available.

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
VB Numeric / Digit Wildcard With Instr
Hello All,
This should be relatively easy but for some reason is not working.
I'm trying to extract six digits and an E (eg 681776E) from a larger string eg (ON RECEIPT 681776E R SUDWE)

Like statement seems to work:

If tempStr Like "*######E*" Then

but I need to extract out the substring hence I need the position
Also tried:

If CInt(InStr(CStr(tempStr), "######E", vbTextCompare)) > 0 Then
Dim Cpos As Integer
Cpos = InStr(CStr(tempStr), "######E", vbTextCompare)
DealIdValue = Strings.Trim(Mid(tempStr, Cpos, Cpos + 6))
End If

Gives me a type mismatch on the if statment -- tried to vb binary compare, w/o the Cint, and [######E].
Any ideas.

SQL Wildcard Query, Access 2000, VB6 With ADO **RESOLVED**
I can fetch a specific record using the following:

VB Code:
Load_lvData "SELECT [Account #], [Customer Id], Status, [Service Address] From Accounts WHERE [Service Address] = 'P.O. BOX 511'"

Now, if I want to fetch all records that contain 'BOX'...

VB Code:
Load_lvData "SELECT [Account #], [Customer Id], Status, [Service Address] From Accounts WHERE [Service Address] LIKE '*BOX*'"

The last SQL statement returns nothing, why?

Added green "resolved" checkmark - Hack

RESOLVED--Wildcard Search Variable For VBA Excel Worksheet
I am having a problem finding the right wildcard character or proper syntax formatting for finding using the below code in finding a worksheet within a workbook to pickout and print if the worksheet has the words "Biweekly Roll Up *" and or anything with words or characters beyond the word "UP". I have 2000 spreadsheets workbooks to search and pull out just the one-5 worksheets within the workbook that starts with the words (Biweekly Roll Up....). I have tried placing an *, %, _,?,~ and non seem to work. Any suggestions?

Public Sub PrintWorkbooks()
    Application.EnableEvents = False
    Application.AskToUpdateLinks = False
    Dim sCurFile As String
    Dim sPath As String
    'Get the path
    sPath = InputBox("Starting path?", "PrintWorkbooks")
    If sPath <> "" Then
        On Error Resume Next
        Application.ScreenUpdating = False
        If Right(sPath, 1) <> "" Then
            sPath = sPath & ""
        End If
        sCurFile = Dir(sPath & "*.xls", vbNormal)
        Do While Len(sCurFile) <> 0
            Workbooks.Open sPath & sCurFile, , True
            With Workbooks(sCurFile)
                '.Worksheets("Biweekly Roll Up").PrintOut
                'Source = Worksheets("Biweekly Roll Up *").Range("A1:S33").PrintOut
                Code:Source = Worksheets("Biweekly Roll Up").Range("A1:S33").PrintPreview
            .Close SaveChanges:=False
            End With
            sCurFile = Dir
        Application.ScreenUpdating = True
        On Error GoTo 0
    End If
End Sub

Edited by - bballava on 7/7/2005 9:17:29 AM

InStr (Resolved)
I am looking to find a certain command in a string, but I only want it to be found if it's the very first thing in the string. How can I do this?

RESOLVED: Problem Using Instr()
Dim jeeves As Integer
For jeeves = 0 To List1.ListCount
Dim somethingthatannoysme As String
somethingthatannoysme = List1.List(jeeves)
If (InStr(0, somethingthatannoysme, "/LF/", 1) <> 0) Then
foundryPots = foundryPots + 1
End If
Next jeeves

I'm trying to search a listbox line by line for the phrase /LF/ but it keeps giving me an invalid procedure or call error here.


Need Help With Instr Function(RESOLVED)
as of now, i'm using the instr function to scan for words in a textbox.

its doing something i don't intend it to do, lets say i have it search for the word "hi" but someone says "hidude" it will pick it up. how can i use this function to only look for words that i put in.

and example of the code is below.

VB Code:
if instr(text1.text,"hi") then'code hereend if

* RESOLVED * Instr/Mid Problem...
I have a string that holds a path called strPath

strPath = "c:folderfile.ext"

I want to have another variable to hold just the path without the filename, i.e.

strFolder = "c:folder"

I've been playing about with Instr, Mid, Left etc. which I've used before, but I can't seem to use Instr to search from the right to left (to find the first "" it finds.

Any suggestions?


Instr Problem(RESOLVED)
ok what i want is to return where was the first "," in a list of numbers like 5555,4444,3333
so I did this:

dim s as String, start as Integer
start = instr(",", s)

and it's return 0 to start
and i dont understand why
I thought it should return 5

Edited by - itay12 on 6/17/2004 11:28:25 PM

Resolved - SQL - Instr$ Question

Is there an equalivant SQL statement that is similar to the INSTR$ statement of VB?

I have a reference field which contains "20439495 CT" and a datasource which says "439495" and I thought this statement would return records containing similiar records to match the one above.

"Reference_Number LIKE ""%" & sRef & "%""

but it doesn't so can anyone help?

Its processed through ADO control, VB6.


Edited by - BAZ on 10/7/2004 7:34:57 AM

*RESOLVED* Parsing A String Using Instr
I'm parsing strings that are in the general format:
I need to get the information between the ";"s. I've gone through a number of tries to get my code to work, but its all failing horribly. The numbers between the ";"s will change in length unpredictably.


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.


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?

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.

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 = ""

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

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

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

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 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 = ""

' 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

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


Any pointers would be appreciated


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

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


Using Wildcard

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

<my_stud_name>Bob Dylan
<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_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_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



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)

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

Private Sub CommandButton2_Click()
Dim memnum As Integer
Dim mark As String
memnum = Val(TextBox1) + 1
mark = TextBox2 & memnum
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)

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

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

If ActiveCell.FormulaR1C1 = TextBox1 Then
memnum = num
memran = "B" & memnum
UserForm1.TextBox1 = ActiveCell.FormulaR1C1
Unload Me
End If
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



Wildcard Replace

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.

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

Wildcard Question

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;

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


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.


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

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:

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:

FROM Projects where (Projects.WBS) Like """ & txtEntryData(0).Text & "#*"";
How can I insure when using mySQL that the second character is a number?

Wildcard && 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,

Wildcard Search
Hi I have this 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;"

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



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!


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

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


Wildcard Querry

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.


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?

If objFSO.FileExists("E:*.BAK") Then 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.


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?


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

If rs.EOF Then
ListView1.Visible = False
MsgBox "No Record Found"
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
'End If
End Sub

Private Sub cmdtotal_Click()
End Sub

Private Sub cmdprevious_Click()
txtno.Text = rs!no
txtname = rs!Name
txtaddress = rs!address
txtage = rs!age
Txtstatus = rs.AbsolutePosition & " of " & rs.RecordCount
If rs.BOF Then
cmdprevious.Enabled = False
cmdfirst.Enabled = False
cmdnext.Enabled = True
cmdlast.Enabled = True
ElseIf rs.EOF Then cmdnext.Enabled = True
cmdlast.Enabled = True
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 can i solve 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???



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

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


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.

Copyright 2005-08, All rights reserved