-
WSHUHandEH
AskWoody LoungerJune 22, 2011 at 8:25 pm in reply to: Is there a simple way to generate dates based of of todays date but 18 year #1284732Hi Marc – Try this ….
=DATE(YEAR(TODAY())-18,MONTH(TODAY()),DAY(TODAY()))Just a question and certainly not a correction, but shouldn’t we be using the vba.date(vba.year(vba.today….etc? to make this global?
Just a question?
Thanks,
Darryl. -
WSHUHandEH
AskWoody LoungerJune 22, 2011 at 3:52 pm in reply to: Doing a DataBase thing where I pull the info, but I want to limit query. #1284701I didn’t notice any mispells, the problem stems from the variable string, which I think was a mistake on my part. The special notation ‘ for some reason needs a valid date variable imo. Once I changed the variable to date, and gave a two variable which worked.
Dim xdate1 as date
Dim ydate2 as datexdate1=(00:00:00)
ydate2=the date value in the format year/month/day format.you need to keep the special notation I am guessing cause it worked fine from that point on, if you add a calander control you can access a database and fire it when you click on the calander.
Thanks Rory. I didn’t think the problem was in the variable.
-
WSHUHandEH
AskWoody LoungerJune 22, 2011 at 12:49 pm in reply to: Doing a DataBase thing where I pull the info, but I want to limit query. #1284684Yes I did, and I got the error , 1004 This operation is not available for extrenal Database.
And Thank you for you effort.
-
WSHUHandEH
AskWoody LoungerJune 22, 2011 at 11:50 am in reply to: Doing a DataBase thing where I pull the info, but I want to limit query. #1284673oops…I meant the captial S, see how it didn’t change itself to a capital, if you declare the variable as a capital S, doesn’t see the s, and it keeps it small, I think the ‘ symbol is key to my problem.
-
WSHUHandEH
AskWoody LoungerJune 22, 2011 at 11:27 am in reply to: Doing a DataBase thing where I pull the info, but I want to limit query. #1284666rory, thanks for your reply
if you take a look at the variable, you will notice that in declaration there is a B S….but in the code it doesn’t see it.
Option Explicit
Sub Macro1()
Dim sYear As String
Dim sMonth As String
Dim sDay As String
sYear = “2011”
sDay = “13”
sMonth = “06”
Range(“A1”).Select
With ActiveSheet.QueryTables.Add(Connection:= _
“ODBC;DSN=VPC – PROD;Description=VPC – PROD;UID=datalink;PWD=datalink;APP=Microsoft® Query;WSID=VPC-PMXP-PLT1;DATABASE=VPC” _
, Destination:=Range(“A2”))
.CommandText = Array( _
“SELECT plate_flow.job_ref, plate_flow.line_number, plate_flow.scanned_time” & Chr(13) & “” & Chr(10) & “FROM VPC.dbo.plate_flow plate_flow” & Chr(13) & “” & Chr(10) & “WHERE (plate_flow.line_number=’1′) AND (plate_flow.scanned_time>{ts ‘ syear-smonth-sday 02:26:48” _
, “‘})”) -
WSHUHandEH
AskWoody LoungerJune 22, 2011 at 11:04 am in reply to: Doing a DataBase thing where I pull the info, but I want to limit query. #1284664Option Explicit
Sub Macro1()
Dim sYear As String
Dim sMonth As String
Dim sDay As String
sYear = “2011”
sDay = “13”
sMonth = “06”
Range(“A1”).Select
With ActiveSheet.QueryTables.Add(Connection:= _
“ODBC;DSN=VPC – PROD;Description=VPC – PROD;UID=datalink;PWD=datalink;APP=Microsoft® Query;WSID=VPC-PMXP-PLT1;DATABASE=VPC” _
, Destination:=Range(“A2”))
.CommandText = Array( _
“SELECT plate_flow.job_ref, plate_flow.line_number, plate_flow.scanned_time” & Chr(13) & “” & Chr(10) & “FROM VPC.dbo.plate_flow plate_flow” & Chr(13) & “” & Chr(10) & “WHERE (plate_flow.line_number=’1′) AND (plate_flow.scanned_time>{ts ‘ syear-smonth-sday 02:26:48” _
, “‘})”) -
WSHUHandEH
AskWoody LoungerThanks for the help, I would like to know, since I am dealing also with decimals, like 8.25, what variable should I use? I keep losing the .25 when it converts the number over, should I avoid single and double?
-
WSHUHandEH
AskWoody LoungerThanks dude,
I tried a few variations of the code, I have never passed an object with an argument.
Thank you kindly.
HUH:)
Oops that not true…I have, but I haven’t used it as the argument.
-
WSHUHandEH
AskWoody LoungerIs this a legal function?
Any one?
Public Function TestAreAnyTrue(ZX As Collection) As Boolean
Dim ctl As Control
TestAreAnyTrue = False
For Each ctl In ZX
If ctl.Value = True Then
TestAreAnyTrue = True
End If
Next ctl
End Function -
WSHUHandEH
AskWoody LoungerHey Rory,
Thanks for your reply,
You gave me that code about 4 years ago:)
Can you tell me why I can’t get this to work?
Passing ZX would be an arugment like Userform1.frame1.controls?
I have about 10 different frames with option buttons and I thought if I could modify your code to possibly handle arguments.
Public Function TestAreAnyTrue(ZX As Variant) As Boolean
Dim ctl As Control
TestAreAnyTrue = False
For Each ctl In ZX
If ctl.Value = True Then
TestAreAnyTrue = True
End If
Next ctl
End Function -
WSHUHandEH
AskWoody LoungerThanks Hans.
-
WSHUHandEH
AskWoody LoungerThanks Hans,
I’ll take your advice on removing the -1, from the (plate), because I am using the split function on the Arrparts, it has produces ” ” elements in the Array, so I’ll keep the -1 when filling the array.
Thanks,
Darryl. -
WSHUHandEH
AskWoody LoungerThanks Hans,
-
WSHUHandEH
AskWoody LoungerDo you already have a list of names? on a worksheet?
Are you trying to accomplish in code?
Thanks,
Darryl. -
WSHUHandEH
AskWoody LoungerIf then number of 4s increases/decreases as the column width is altered, then I suspect a number format involving an asterisk.
You guys really are experts!
I changed the format of the cell to General, and input the value and it is ok now,
Thanks,
Darryl.
![]() |
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
-
Multiple Partitions?
by
CWBillow
2 hours, 35 minutes ago -
World Passkey Day 2025
by
Alex5723
1 hour, 59 minutes ago -
Add serial device in Windows 11
by
Theodore Dawson
17 hours, 13 minutes ago -
Windows 11 users reportedly losing data due forced BitLocker encryption
by
Alex5723
4 hours, 50 minutes ago -
Cached credentials is not a new bug
by
Susan Bradley
21 hours, 46 minutes ago -
Win11 24H4 Slow!
by
Bob Bible
21 hours, 57 minutes ago -
Microsoft hiking XBox prices starting today due to Trump’s tariffs
by
Alex5723
19 hours, 8 minutes ago -
Asus adds “movement sensor” to their Graphics cards
by
n0ads
1 day ago -
‘Minority Report’ coming to NYC
by
Alex5723
20 hours, 27 minutes ago -
Apple notifies new victims of spyware attacks across the world
by
Alex5723
1 day, 8 hours ago -
Tracking content block list GONE in Firefox 138
by
Bob99
1 day, 8 hours ago -
How do I migrate Password Managers
by
Rush2112
16 hours, 3 minutes ago -
Orb : how fast is my Internet connection
by
Alex5723
17 hours, 52 minutes ago -
Solid color background slows Windows 7 login
by
Alex5723
1 day, 20 hours ago -
Windows 11, version 24H2 might not download via Windows Server Updates Services
by
Alex5723
1 day, 19 hours ago -
Security fixes for Firefox
by
Susan Bradley
19 hours, 27 minutes ago -
Notice on termination of services of LG Mobile Phone Software Updates
by
Alex5723
2 days, 7 hours ago -
Update your Apple Devices Wormable Zero-Click Remote Code Execution in AirPlay..
by
Alex5723
2 days, 16 hours ago -
Amazon denies it had plans to be clear about consumer tariff costs
by
Alex5723
2 days, 7 hours ago -
Return of the brain dead FF sidebar
by
EricB
1 day, 18 hours ago -
Windows Settings Managed by your Organization
by
WSDavidO61
21 hours, 31 minutes ago -
Securing Laptop for Trustee Administrattor
by
PeachesP
6 minutes ago -
The local account tax
by
Susan Bradley
1 day, 19 hours ago -
Recall is back with KB5055627(OS Build 26100.3915) Preview
by
Alex5723
3 days, 5 hours ago -
Digital TV Antenna Recommendation
by
Win7and10
2 days, 21 hours ago -
Server 2019 Domain Controllers broken by updates
by
MP Support
3 days, 17 hours ago -
Google won’t remove 3rd party cookies in Chrome as promised
by
Alex5723
3 days, 18 hours ago -
Microsoft Manager Says macOS Is Better Than Windows 11
by
Alex5723
3 days, 22 hours ago -
Outlook (NEW) Getting really Pushy
by
RetiredGeek
3 days ago -
Steps to take before updating to 24H2
by
Susan Bradley
2 minutes ago
Recent blog posts
Key Links
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
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.