-
WSsantosm
AskWoody LoungerHi,
strName already has a value applied to it from the form, in this case a company name.Thanks,
MarkWhat have you set strName equal to? The variable needs it’s data from somewhere.
-
WSsantosm
AskWoody LoungerThanks!
Just in case you ever have a more complicated (more than two-choice) scenario where you’d prefer to use Select Case, note that you can use wildcards within Select Case if you structure it like this:
Code:Dim strX As String strX = "porcupine" Select Case True Case strX Like "porco*" MsgBox "o" Case strX Like "porcu*" MsgBox "u" Case Else MsgBox "Nope" End Select
-
WSsantosm
AskWoody LoungerHi Hans,
Thanks!Mark
You can’t use wildcards in Select Case … End Case.
Try
Code:If strName Like "*anyname*" Then Me.Command123.Visible = True Else Me.Command123.Visible = False End If
or even
Me.Command123.Visible = (strName Like “*anyname*”)
-
WSsantosm
AskWoody LoungerHi Wendell,
VBA, but now I see that Hans has said I cannot use wildcards in a select method.Thanks,
MarkMark, is this a Select Case in VBA, or is it a SELECT CASE in T-SQL (SQL Server or equivalent)? The replies have assumed it was in VBA, but from your code, it could well be a view or query in SQL Server.
-
WSsantosm
AskWoody LoungerHi Andrew and Pat,
What I am looking for is to filter based on a name using wildcards. The name might be something like Acme North, Acme South, Acme West, etc. I tried using:case “*Acme*” but it wouldn’t find any of those names.
Thanks,
MarkDo you mean, if there is anything in the strName variable ?
If that is the case then this ought to work
[Code]
Select Case Len(strName)
Case 0
command123.visible = False
Case Else
command123.visible = True
End Select
[/Code]If not you need to clarify what is likely to be in strName, and what you are looking to check
If you are only looking for one of 2 options though, you could just as easily use an IF
[Code]
IF Len(strName) =0 Then
command123.visible = False
Else
command123.visible = True
End If
[/Code]Indeed in Both cases you could possibly just check for strName=””
-
WSsantosm
AskWoody LoungerHi Hans,
Thanks again!I couldn’t get the “nomatch” thing to work but the rest is working. I will play around with it later…
Thanks,
MarkYou can use code like this. I’ve assumed that the code is to be run from the main form:
Code:Dim rst As DAO.Recordset Set rst = Me.SubFormName.Form.RecordsetClone rst.FindFirst "ID = " & Me.txtFindID If rst.NoMatch Then Beep Else ' Move to the record Me.SubFormName.Form.Bookmark = rst.Bookmark ' Set focus to the subform Me.SubFormName.SetFocus ' Optional: set focus to a specific control Me.SubFormName!SomeControl.SetFocus End If Set rst = Nothing
Notes:
– You need a reference to the Microsoft DAO 3.6 Object Library (if you’re using an .mdb database).
– Replace SubFormName with the name of your subform as a control on the main form.
– Replace SomeControl with the name of the control on the subform you want to set focus to (this is optional).
– Replace “ID = ” & Me.txtFindID with the condition you want to use. -
WSsantosm
AskWoody LoungerHi Andrew,
That looks good. I will give it a try.Thanks,
MarkHave you tried something like this which was found here – http://www.experts-exchange.com/Web_Develo…Q_11973538.html
dim startTimer, currentTimer
dim duration ‘in seconds
duration=30startTimer=timer
do while currentTimer<(startTimer+duration)
currentTimer=timer
Loop -
WSsantosm
AskWoody LoungerHi Hans,
OK, no problem. I will keep trying things and if I come across something that works, I will post back.Take care,
MarkI meant the Window.setTimeOut mentioned near the end – this will only work for web pages.
I use VBScript very rarely, and then for very simple things only, so I can’t offer much help.
-
WSsantosm
AskWoody LoungerHi Hans,
I can try this but “Sleep” is also not in the keyword list. I am now wondering if some sort of “Timer” DO/LOOP would work.Thanks,
MarkDoes VBScript – sleep command help? (See the replies near the bottom of the thread)
-
WSsantosm
AskWoody LoungerThat sounds like it may work. Any idea how you would monitor the clock?
Thanks,
MarkPerhaps you can write a Do loop that simply burns up time doing something useless and monitoring the clock. However, if the goal is to let another process proceed in the background, you may need to find a method similar to Sleep (assuming the equipment is capable of multi-tasking different processes).
-
WSsantosm
AskWoody LoungerHi,
WScript will not work with VBS 5.5. Do you have any ideas of another way to waste a second or two?Thanks,
MarkI can use WScript.Sleep in a .vbs file without problems – see attached sample.
-
WSsantosm
AskWoody LoungerHi Hans,
I will try but I am not seeing that in the VBS 5.5 command reference.Thanks,
MarkI can use WScript.Sleep in a .vbs file without problems – see attached sample.
-
WSsantosm
AskWoody LoungerHi,
The equipment is a machine that acts like a printer with programmable input. There is an option to run VBScript 5.5 compliant commands with the job file when it runs. Looking at the VBS 5.5 help file I have, that Wscript method is not there, so I am not sure it will work. Any other ideas?Thanks,
MarkNot sure what you mean by “a piece of equipment,” but if it runs the Windows Script Host, check out the WScript.Sleep Method. (This method is not part of native VBS.)
-
WSsantosm
AskWoody LoungerHi Hans,
Since this is something we do quite a bit with the DB and it is inefficient in it’s current state, I think I will dive in….Thanks,
MarkYou can use Automation to control Outlook from Access using VBA – you could read messages in a mail folder, extract and process the subject and/or body of the messages, then move them to another folder.
This is not extremely difficult, but it requires that you are reasonably familiar with both Access VBA and Outlook VBA.See WendellB’s tutorial Automation 101 for an introduction and useful links, and search this forum for Outlook.Application to see examples.
-
WSsantosm
AskWoody LoungerYou can try using the
Me.AllowEdits = True (or false)
based on conditions for the form. I use this all the time and it works great. You would need to go to the code window for specific event on the form, like On Open for instance, and add the code there.
Mark
Hello all, I was wondering if anyone knows how to diable the editing on the form besides turning off the allow edits in the property sheet. Is it possible to turn it off for tha whole form using vb code. Thank you in advance.
![]() |
Patch reliability is unclear, but widespread attacks make patching prudent. Go ahead and patch, but watch out for potential problems. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Fedora Linux is now an official WSL distro
by
Alex5723
1 hour, 13 minutes ago -
May 2025 Office non-Security updates
by
PKCano
1 hour, 39 minutes ago -
Windows 10 filehistory including onedrive folder
by
Steve Bondy
3 hours, 34 minutes ago -
pages print on restart (Win 11 23H2)
by
cyraxote
2 hours, 50 minutes ago -
Windows 11 Insider Preview build 26200.5581 released to DEV
by
joep517
5 hours, 46 minutes ago -
Windows 11 Insider Preview build 26120.3950 (24H2) released to BETA
by
joep517
5 hours, 48 minutes ago -
Proton to drop prices after ruling against “Apple tax”
by
Cybertooth
13 hours, 9 minutes ago -
24H2 Installer – don’t see Option for non destructive install
by
JP
2 hours, 52 minutes ago -
Asking Again here (New User and Fast change only backups)
by
thymej
1 day ago -
How much I spent on the Mac mini
by
Will Fastie
3 hours, 2 minutes ago -
How to get rid of Copilot in Microsoft 365
by
Lance Whitney
1 hour, 41 minutes ago -
Spring cleanup — 2025
by
Deanna McElveen
1 day, 6 hours ago -
Setting up Windows 11
by
Susan Bradley
1 hour, 25 minutes ago -
VLC Introduces Cutting-Edge AI Subtitling and Translation Capabilities
by
Alex5723
1 day, 1 hour ago -
Powershell version?
by
CWBillow
1 day, 2 hours ago -
SendTom Toys
by
CWBillow
10 hours, 59 minutes ago -
Add shortcut to taskbar?
by
CWBillow
1 day, 6 hours ago -
Sycophancy in GPT-4o: What happened
by
Alex5723
1 day, 23 hours ago -
How can I install Skype on Windows 7?
by
Help
1 day, 21 hours ago -
Logitech MK850 Keyboard issues
by
Rush2112
1 day, 4 hours ago -
We live in a simulation
by
Alex5723
2 days, 13 hours ago -
Netplwiz not working
by
RetiredGeek
1 day, 23 hours ago -
Windows 11 24H2 is broadly available
by
Alex5723
3 days, 1 hour ago -
Microsoft is killing Authenticator
by
Alex5723
3 hours, 25 minutes ago -
Downloads folder location
by
CWBillow
3 days, 8 hours ago -
Remove a User from Login screen
by
CWBillow
2 days, 3 hours ago -
TikTok fined €530 million for sending European user data to China
by
Nibbled To Death By Ducks
2 days, 23 hours ago -
Microsoft Speech Recognition Service Error Code 1002
by
stanhutchings
2 days, 23 hours ago -
Is it a bug or is it expected?
by
Susan Bradley
1 day, 1 hour ago -
Image for Windows TBwinRE image not enough space on target location
by
bobolink
2 days, 22 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.