473,624 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Looks like a wildcard would work: Any ideas VB 6.0 VS Access

Dököll
2,364 Recognized Expert Top Contributor
Greetings Again, All!

I know a bit more of the back end of things than front. Every now and then I use wildcard to retrieve data via sql advantage, oracle, and of course, our beloved MS Access ;-) I can't seem to find a wild card that will work in VB 6.
in spl advantage Ic an ue a 'Sam%' to find all Sam(s) and '%Sam' for Sam like, Example Samuel would show up here. Is there such a thing in VB 6, recent searches and reading hve come up empty, VB in "twenty one days" is useless; any ideas!

Dököll
Nov 26 '06 #1
21 3452
Dököll
2,364 Recognized Expert Top Contributor
Greetings Again, All!

I know a bit more of the back end of things than front. Every now and then I use wildcard to retrieve data via sql advantage, oracle, and of course, our beloved MS Access ;-) I can't seem to find a wild card that will work in VB 6.
in spl advantage Ic an ue a 'Sam%' to find all Sam(s) and '%Sam' for Sam like, Example Samuel would show up here. Is there such a thing in VB 6, recent searches and reading hve come up empty, VB in "twenty one days" is useless; any ideas!

Dököll
For got to post what I hd in mind, let's say it were:

Expand|Select|Wrap|Line Numbers
  1. Dim GoSplit As Variant
  2. Dim strGetWords As String
  3.  
  4. FileName = "\usermate.txt"
  5. f = FreeFile
  6. Open App.Path + FileName For Input As 1
  7. Do While Not EOF(f)
  8. Line Input #1, strGetWords
  9. GoSplit = Split(strGetWords, " ")
  10.  
  11. If strGetWords$ like "bus" <> 0 Then  '  want bus but I also get bus from busted
  12. 'Is there anything to add here that would make only the instance of bus to pop up
  13.  
  14. 'Adding asterisk as in "bus*" give me nada, not a thing...
  15.  
  16. Text4(8).Text = "bus"
  17. End If
  18.  
  19. 'What I hope to do make sure "busted" is not picked up since "bus" gets picked up from "busted"
  20.  
  21. I am posting this because I did find a solution.  If you recall, I decided to set visibility to false for the text bx that would have carried "bus" if "busted" was found.  The problem is I had an error 'procedure too large, proof that my if statement was out of this world.  A wildcard woul greatly reduce my risks, I do not appreciate that pop up too much "Procedure Too LARGE!" what is that?
  22.  
  23. What are yur thoughts on this?
  24.  
  25. Dököll
  26.  
  27.  
Nov 26 '06 #2
Killer42
8,435 Recognized Expert Expert
You should check the online help for the Like operator, but I think you'll find the asterisk (*) is the wildcard character you're after.
Nov 26 '06 #3
Dököll
2,364 Recognized Expert Top Contributor
You should check the online help for the Like operator, but I think you'll find the asterisk (*) is the wildcard character you're after.
I'll give it a whirl, many thanks...I'm surprised 'help' included with thr software did no provide much assistance. Will let you know...
Nov 26 '06 #4
Dököll
2,364 Recognized Expert Top Contributor
I think I figured out why (*) as wildcard is not working through VB 6.0 Professional. Checked Knowledge base, my attempt is to grab what I want from a .txt file where text (lyrical conten) would be temporarily stored. VB does give me the option to use the Like operator but to retrieve from an access database (Recordset) or other. I should have been more specific (VB 6.0 Vs .txt file). I will shrink the code in hopes that'll do the trick. Thanks for your support and assistance. I'll post my findings here when found, should help us tackle this mistery...

Dököll
Nov 26 '06 #5
Killer42
8,435 Recognized Expert Expert
According to the doco...
Like Operator Example
This example uses the Like operator to compare a string to a pattern.
Expand|Select|Wrap|Line Numbers
  1. Dim MyCheck
  2. MyCheck = "aBBBa" Like "a*a"   ' Returns True.
  3. MyCheck = "F" Like "[A-Z]"     ' Returns True.
  4. MyCheck = "F" Like "[!A-Z]"    ' Returns False.
  5. MyCheck = "a2a" Like "a#a"     ' Returns True.
  6. MyCheck = "aM5b" Like "a[L-P]#[!c-e]"  ' Returns True.
  7. MyCheck = "BAT123khg" Like "B?T*"      ' Returns True.
  8. MyCheck = "CAT123khg" Like "B?T*"      ' Returns False.
I've just tested the second example in plain VB6, and it worked. I found that when looking it up in the MSDN doco, it had two entries - VB and VBA. As is (for some weird reason) so often the case, selecting VBA gave me the relevant info, while VB gave me the info relating to an SQL query.
Nov 26 '06 #6
Dököll
2,364 Recognized Expert Top Contributor
According to the doco...I've just tested the second example in plain VB6, and it worked. I found that when looking it up in the MSDN doco, it had two entries - VB and VBA. As is (for some weird reason) so often the case, selecting VBA gave me the relevant info, while VB gave me the info relating to an SQL query.
Indeed, Saw it too, thought it to be helpful, but I have to admit I do not quite understand it, nor can I use it it seems. The txt file is added then read straight away. Seems like a wild card does not work for a .txt file, here is another protion of the code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub GtWords_Click()
  2.  
  3. If Text6.Text = "" Then
  4. MsgBox ("Looks, you forgot to add a lyric please add lyrical text to continue!")
  5. Text6.SetFocus
  6. ElseIf Text6.Text <> "" Then      
  7.  
  8. Open App.Path + "\usermate.txt" For Output As #1 'file is opened as inWrite because it is Writing back into the program
  9.                 Write #1, , Text6.Text
  10.  
  11.                 Close #1
  12.  
  13. Dim GoSplit As Variant
  14. Dim strGetWords As String
  15.  
  16. FileName = "\usermate.txt"
  17. f = FreeFile
  18. Open App.Path + FileName For Input As #1
  19. Do While Not EOF(f)
  20. Line Input #1, strGetWords
  21. GoSplit = Split(strGetWords, " ")
  22.  
  23.  
'This helps record the whole text from Text6 andbe read to find words collected. As we exchange notes, I am begining to see perhpas, the text must be added already formatted, therefore no "bus" even though busted is found (busted is not among words to find in text. We're still looking...thank you by te way, for posting your example from the microsoft site, I think I'll plug in some of it, trweak it see what happens. Again I have yet to undertstand it:

The SQL command I will be using later on will support your helpful comment previously added, fuzzy a bit, I think I should be good. It looks as though this sort of a command will not work to grab the absolute value:::::::::: ::::Whoa, Do you know about abolutevalue in VB, I learned there was such athing. What if I looked for the abolute value in strGetWords$, would that do the trick. Gotta go....

Dököll, thanks for posting
Nov 27 '06 #7
Killer42
8,435 Recognized Expert Expert
Indeed, Saw it too, thought it to be helpful, but I have to admit I do not quite understand it, nor can I use it it seems. The txt file is added then read straight away. Seems like a wild card does not work for a .txt file
I'm afraid I couldn't really tell much from the code.

Could you give more detail on exactly how the Like operator "doesn't work"? Maybe it's something we can fix, because I've tested one or two of the samples from the documentation, and it definitely did work. I don't see how a text file being involved would affect it.

As for "abolute value" :- if you mean absolute value, then that is basically just a number without taking the sign into account. So for example, Abs(-3) and Abs(3) would both return the value 3. I don't see how it would apply to a string.
Nov 27 '06 #8
Dököll
2,364 Recognized Expert Top Contributor
I'm afraid I couldn't really tell much from the code.

Could you give more detail on exactly how the Like operator "doesn't work"? Maybe it's something we can fix, because I've tested one or two of the samples from the documentation, and it definitely did work. I don't see how a text file being involved would affect it.

As for "abolute value" :- if you mean absolute value, then that is basically just a number without taking the sign into account. So for example, Abs(-3) and Abs(3) would both return the value 3. I don't see how it would apply to a string.
Right on point, I spoke too soon, thanks for replying. The like operator works when I send the words found to an Access database, whereby frequent hits to it, unsing a wildcard (*), grabs all instances of "bus" inthe database. The problem is before the text is formatted to reflect exactly what the program asked, the format is useless; it's as if pickingup a dictionary and looking up words. When GtWords button is pushed, the code I previously posted starts running, accompagnied by a series of if statements, as in this posted solution:

Dim GoSplit As Variant
Dim strGetWords As String

FileName = "\usermate. txt"
f = FreeFile
Open App.Path + FileName For Input As 1
Do While Not EOF(f)
Line Input #1, strGetWords
GoSplit = Split(strGetWor ds, " ")

If InStrB(strGetWo rds$, "busted") <> 0 Then

Text4(9).Text = "busted"
convert_my_text ="BUSTED
convert_me_modu .change_it_now 'this fires up my module named conert_me_modu
End If


''''''Additiona l if statements are added here,

My Module

Public convert_my_text As String

Public Sub change_it_now ()

If UCase(convert_m y_text) = "BUSTED" Then
'first value performed
LyricalContentf ind.Text4(9).Te xt = ""
'empty string works here, no need to set vsibilty to false
End If

End Sub


'This is working, but I will need to also tell VB the words I do not need it to find, thus busted. A wildcard, if it exists for searching a .txt file should do the trick, since searching the actual database "Bus*" does in fact give me "Bus", addded/found from different text, typed my son's "the magic school bus" grabbed "the wheels on the bus" as well from my database; this means, my recordset had two hits for bus...

If a 'something_wild card' can be used for .txt, whether it picks up "bus" a number of times, the results will be specific to only "bus" not busted. I attempting vbTextCompare again, perhaps something's a miss. Oh! here is what my Like operator atttempt loked like:

Expand|Select|Wrap|Line Numbers
  1. If strGetWords$ Like "dancing" <> 0 Then
  2. Text17(10).Text = "Dancing"
  3. End If
'If you typed up godancing, you got dancing out of that. I gt an idea :-)
In a bit!
Nov 27 '06 #9
Killer42
8,435 Recognized Expert Expert
Oh! here is what my Like operator atttempt loked like:
Expand|Select|Wrap|Line Numbers
  1. If strGetWords$ Like "dancing" <> 0 Then
  2. Text17(10).Text = "Dancing"
  3. End If
'If you typed up godancing, you got dancing out of that. I gt an idea :-)
In a bit!
I suppose it might depend on the Option Compare setting, which I've never touched. But as far as I know, that Like comparison will return the same result as using the = operator. The whole point of Like is that it allows you to use wildcards to indicate patterns or unknown parts in the string. By the way, the <> 0 is pointless, as well. The only two values that might be returned from the Like comparison are True (-1) and False (0). You’d do better to say If strGetWords$ Like "whatever" Then

How's this for an idea? If you have a string and you want to check whether a specific word appears within it, say "dancing", and you don't care about the case (upper/lower), perhaps you could use this...
Expand|Select|Wrap|Line Numbers
  1. If Lcase(strGetWords$) Like "* dancing *"0 Then
  2.   …
  3. End If
You might also want to try this, to account for words at the start or end of the string.
Expand|Select|Wrap|Line Numbers
  1. If Lcase(strGetWords$) Like "* dancing *" _
  2.     Or Lcase(strGetWords$) Like "dancing *" _
  3.     Or Lcase(strGetWords$) Like "* dancing" _
  4.     Then
  5.        …
  6. End If
One thing I don't understand is this. If you have already used Split to separate the string into words, why don't you just loop through and use = to check each of them?
Nov 27 '06 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3750
by: Law.Win | last post by:
I have an IIF statement in the criteria of a query. I would like to know how to use a wildcard with the varaibles inside it. For example IIF(, , ) I would like the wildcard after variable 2. Thanks in advance
0
2907
by: Torsten | last post by:
I am attempting to issue an SQL query in C# to and Access database using the Microsoft.Jet.OLEDB.4.0 provider. The only wildcard character that seems to work is ‘%’. When using ‘#’, ‘?’, and ‘*’ as wildcards, the results returned are always null. An example of a query that does work is: SELECT SampleIndex FROM SampInfo
2
2136
by: Ken Yee | last post by:
First a little background: I've written an httphandler to handle wildcard extensions (i.e., I want to handle all URLs that come in rather than just URLs w/ a specific file extension so I can give friendly names to various dynamic web pages). To do this, I've written an httphandler and put it in the web.config for my webapp (stored in the wwwroot\webapp directory). It works great for the most part; I get to handle any URLs below my webapp...
2
1667
by: JohnT | last post by:
Okay... I'm using VB.net (2003) and I am accessing an MS Access DB file. I have two DataAdapters that I use to search for specific info. The two of them are similar except one is a Date, the other is a String. Currently they both work as I like and I can get my data as I want. What I'm intersted in is seeing HOW I do a Global search for both cases. Here are my two issues: ISSUE 1:
7
2535
by: SlimFlem | last post by:
I have searched hard for 2 days on this and keep hitting a wall. I have a custom IHttpHandler setup to do Url mappings to prop up some old Urls for our site. I have also created a wildcard mapping in IIS6 using the ASP.NET 2.0 ISAPI DLL. Here is what I am attempting and I cannot for the life of me figure this out. I have several situations:
13
4319
by: hawkesed | last post by:
If I have a list, say of names. And I want to count all the people named, say, Susie, but I don't care exactly how they spell it (ie, Susy, Susi, Susie all work.) how would I do this? Set up a regular expression inside the count? Is there a wildcard variable I can use? Here is the code for the non-fuzzy way: lstNames.count("Susie") Any ideas? Is this something you wouldn't expect count to do? Thanks y'all from a newbie. Ed
2
3989
by: googlegroups.dsbl | last post by:
I'm really confused here, and am wondering if someone knows what could be the issue with my TableAdapter query. A few months ago, I created a really neat program that has th ability to search by a client account number. In the TableAdapter, I created a new query called "FillbyAccountNumber". When I created this, I set up the SELECT statement so that it selected all the fields I wanted and then used the following WHERE clause: WHERE...
11
22319
by: google | last post by:
I need a simple wildcard pattern matching function written in JS. I have wrestled with regular expresions but frankly am struggling to come up with anything less than an epic function of many lines of code ... Any help much appreciated! Sample string : "the cat sat on the mat" matches : "the cat*" , "*cat*" , "*the mat"
5
6480
by: Dave | last post by:
I need to filter an Access 2000 result set in ASP 30 using the ADO recordset.filter. I build the filter in pieces. The first clause of the filter is this... WHERE word LIKE 'S%' ... to which other clauses are appended with AND. This all works fine as long as I provide a condition for the first clause
0
8236
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8679
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8621
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7159
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4079
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.