-
WSkwvh
AskWoody Lounger> Where do you find documentation for things like that?
In the Access VBA help.
> I am trying to actually get the tab itself to have the focus and not the first field on the tab. Is that possible?
Don’t think so.
Hans,
Using the Me.TabCtl0.Value = 3 in the on open event, I can hit Control Tab once the form opens and the tab is highlighted/has the focus. Is there a way to send shift tab after the Me.TabCtl0.Value = 3?
Sorry to be so dense.
Thanks,
Ken
-
WSkwvh
AskWoody LoungerYou have to set the Value of the tab control. The value is the zero-based index of the active tab page. Setting it to 0 activates the first page, setting it to 1 activates the second page, etc.
So if you want to set focus to the fourth tab page, you’d use
Me.TabCtl0.Value = 3
Thanks Hans.
Where do you find documentation for things like that?
Having asked that, using the above sets the focus on the first control on the tab. I am trying to actually get the tab itself to have the focus and not the first field on the tab. Is that possible?
Thanks for your help.
Ken
-
WSkwvh
AskWoody LoungerYou May be able to use the AutoKeys Macro to redefine the F1 Key.
If you do a help search on AutoKeys it should tell you how to do this.
You need to Create a Macro and show the macroNames column
In the name column Define the Name as {F1} (same syntax as with sendkeys.
In the action Box you can then use RUNCODE to call your own function to run a suitable help pop up.
Hope that helps.
Andrew,
Thank you for the suggestion. I will give it a try.
Ken
-
WSkwvh
AskWoody LoungerYou can’t use an Access table for this.
You’d have to create a Windows Help file (.hlp) or a HTML Help file (.chm) and specify that in the Help File property. There are specialized tools to create such help files.
Each subject in a help file has a Help Context ID that uniquely identifies it.Thanks Hans.
A Google search for help authoring tools is overwhelming and the tools seem to have more bells and whistles than I really wanted to include. Maybe I can just create a little something that reroutes the F1 key, and present the info to the user in a pop up window.
Thanks for your help. As usual, you are dead on.
Ken
-
WSkwvh
AskWoody LoungerOctober 8, 2009 at 8:33 pm in reply to: Importing Fixed width file with different record types #1180652The essential line is
ShowFiles = .SelectedItems(1)
Because ShowFiles is the name of the function, this tells VBA that the function should return the value of .SelectedItems(1). It wouldn’t have worked if the line had been
SomethingElse = .SelectedItems(1)
that makes sense.
Thanks, Hans!
-
WSkwvh
AskWoody LoungerOctober 8, 2009 at 7:14 pm in reply to: Importing Fixed width file with different record types #1180649You could create a function:
Code:Function ShowFiles() As String With Application.FileDialog(msoFileDialogFilePicker) .InitialFileName = "C:AIR*.*" If .Show Then ShowFiles = .SelectedItems(1) Else MsgBox "No file selected", vbInformation End If End With End Function
Ah! so setting the function ShowFiles as a string, that allows passing values back to calling code. Awesome.
Hans, thank you not only for your help, but for your patience.
Ken
-
WSkwvh
AskWoody LoungerOctober 8, 2009 at 6:13 pm in reply to: Importing Fixed width file with different record types #1180632You can use Application.FileDialog to let the user select the file. See [post=”735585″]Post 735585[/post] for example code.
Hans,
That worked GREAT! However, I had to use the follwing within the module and not as a sub.
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim r As Long
Dim strFile As String
Dim f As Integer
Dim strLine As String
Dim lngPos1 As Long
Dim lngPos2 As LongOn Error GoTo ErrHandler
Set db = CurrentDbWith Application.FileDialog(msoFileDialogFilePicker)
.InitialFileName = “C:AIR*.*”
If .Show Then
strFile = .SelectedItems(1)
Else
MsgBox “No file selected”, vbInformation
End If
End Withf = FreeFile
Open strFile For Input As #f
. . .If I want to call the sub and pass the .SelectedItems(1) back to the calling module, what is the syntax? In other words instead of using the above as a part of the onclick event, I want to do something like:
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim r As Long
Dim strFile As String
Dim f As Integer
Dim strLine As String
Dim lngPos1 As Long
Dim lngPos2 As LongOn Error GoTo ErrHandler
Set db = CurrentDbstrFile=ShowFiles()
f = FreeFile
Open strFile For Input As #f
. . .Does that make any sense? I am probably not using the correct terms.
-
WSkwvh
AskWoody LoungerOctober 7, 2009 at 6:58 pm in reply to: Importing Fixed width file with different record types #1180422See [post=”795434″]Post 795434[/post] for an example.
Hans,
THANKS! I like this much better. A cleaner approach, and more control.
As a followup, is it possible to have the user navigate to the file, instead of hardcoding it? For example the incoming file will not always have the same file name, unless I force the user rename the file once they get it.
As always, thank you sharing your brilliance.
Ken
-
WSkwvh
AskWoody LoungerOctober 7, 2009 at 5:52 pm in reply to: Importing Fixed width file with different record types #1180417See [post=”795434″]Post 795434[/post] for an example.
That looks interesting. I will play with it.
THANKS!
-
WSkwvh
AskWoody LoungerOctober 7, 2009 at 5:26 pm in reply to: Importing Fixed width file with different record types #1180415An alternative would be to use VBA to open the text file, read it line by line and add the data to the appropriate tables. But this will probably be slower than the method you use now.
Thanks Hans. Just for kicks and giggles, how do you open a text file via VBA?
-
WSkwvh
AskWoody LoungerWhat command do you use to export, OutputTo or TransferText, or maybe some other way?
New discovery. If I move the field from the first position in the query to the second, it DOES leave the zeros in.
Weird.
-
WSkwvh
AskWoody LoungerWhat command do you use to export, OutputTo or TransferText, or maybe some other way?
Right now I am in test mode, so I am not exporting via VBA, but instead export the query manually (Export/Save As Type/Text Files (*.txtl;*.csv;*.tab;*.asc), give it a name. When I exported delimited I set the field widths.
-
WSkwvh
AskWoody LoungerExporting ignores the format set for a numeric column; you must use the Format function or a text field.
When I export from Access 2002 to a text file, leading zeros created by the Format function or in a text field are preserved.
Which application are you using to view the exported file? If I open such a file in Excel, it tries to interpret a column as numeric if possible, so I lose the leading zeros. But if I use Notepad, I do see them.
Obviously I am doing something wrong then, as I use Notepad to open. I am using Access 2003, and I tried both the Format function as well as exporting as a text field. I even tried hard-coding the data, instead of using the field in the table. The following SQL Statement is an example of the query.
SELECT Format(23396,”000000000″) AS ID, tmpTEST.ICN, tmpTEST.HICN, tmpTEST.I_txtPersonID, tmpTEST.I_txtLastName, tmpTEST.I_txtFirstName, tmpTEST.Gender, tmpTEST.DOB
FROM tmpTEST;Yet the results drop the leading zeros in the first field.
-
WSkwvh
AskWoody LoungerThanks Mark,
I, too, use CutePDF, but I’ll look into the code that you mentioned.
Here’s a sample using Lebans’ class.
[post=”776166″]Post 776166[/post]
-
WSkwvh
AskWoody LoungerAre you sure that it’s a good idea to delete a printer using VBA?
See How to Add/Delete Printer Programatically using API? for the code needed.
You may recall a few months back I asked about TIFF printers.
Long story short, we acquired a PeerNet product “TIFF Image Printer”. It allowed programming in the path and file name, similar to Stephen Lebans pdf (similar being a relative term).
The code written to access the TIFF printer in code creates an instance of the TIFF printer and creates the TIFF files as expected. However, when done, it leaves the TIFF printer installed. So in one case, the user had over 300 printers, 294 of which were TIFF printers that had not been deleted.
So I figured if there was a way to delete printers with names starting with values 0-9 I could delete them after printing. I hope this makes sense.
Thanks for your help.
Ken
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
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
-
Global data centers (AI) are driving a big increase in electricity demand
by
Kathy Stevens
2 hours, 25 minutes ago -
Office apps read-only for family members
by
b
1 hour, 29 minutes ago -
Defunct domain for Microsoft account
by
CWBillow
6 hours, 31 minutes ago -
24H2??
by
CWBillow
7 hours, 14 minutes ago -
W11 23H2 April Updates threw ‘class not registered’
by
WindowsPersister
10 hours, 15 minutes ago -
Master patch listing for April 8th, 2025
by
Susan Bradley
3 hours, 28 minutes ago -
TotalAV safety warning popup
by
Theodore Nicholson
9 hours, 55 minutes ago -
two pages side by side land scape
by
marc
1 day, 23 hours ago -
Deleting obsolete OneNote notebooks
by
afillat
2 days, 1 hour ago -
Word/Outlook 2024 vs Dragon Professional 16
by
Kathy Stevens
1 day, 4 hours ago -
Security Essentials or Defender?
by
MalcolmP
1 day, 7 hours ago -
April 2025 updates out
by
Susan Bradley
1 hour, 59 minutes ago -
Framework to stop selling some PCs in the US due to new tariffs
by
Alex5723
1 day ago -
WARNING about Nvidia driver version 572.83 and 4000/5000 series cards
by
Bob99
14 hours, 27 minutes ago -
Creating an Index in Word 365
by
CWBillow
1 day, 16 hours ago -
Coming at Word 365 and Table of Contents
by
CWBillow
5 hours, 2 minutes ago -
Windows 11 Insider Preview Build 22635.5170 (23H2) released to BETA
by
joep517
2 days, 20 hours ago -
Has the Microsoft Account Sharing Problem Been Fixed?
by
jknauth
2 days, 23 hours ago -
W11 24H2 – Susan Bradley
by
G Pickerell
3 days, 1 hour ago -
7 tips to get the most out of Windows 11
by
Alex5723
2 days, 23 hours ago -
Using Office apps with non-Microsoft cloud services
by
Peter Deegan
2 days, 17 hours ago -
I installed Windows 11 24H2
by
Will Fastie
23 hours, 18 minutes ago -
NotifyIcons — Put that System tray to work!
by
Deanna McElveen
3 days, 5 hours ago -
Decisions to be made before moving to Windows 11
by
Susan Bradley
3 hours, 57 minutes ago -
Port of Seattle says ransomware breach impacts 90,000 people
by
Nibbled To Death By Ducks
3 days, 13 hours ago -
Looking for personal finance software with budgeting capabilities
by
cellsee6
2 days, 21 hours ago -
ATT/Yahoo Secure Mail Key
by
Lil88reb
2 days, 21 hours ago -
Devices with apps using sprotect.sys driver might stop responding
by
Alex5723
4 days, 6 hours ago -
Neowin – 20 times computers embarrassed themselves with public BSODs and goofups
by
EP
4 days, 15 hours ago -
Slow Down in Windows 10 performance after March 2025 updates ??
by
arbrich
14 hours, 27 minutes 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.