473,791 Members | 3,090 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Non-programmer needs help with VB code to locate file on hard drive

Long story short: My Access developer is letting me down. He doesn't
really know VB and he can't figure out how to do what I need.

Situation:
Access database that will be used locally on individual user's
machines.

What I need:
I need code to make Access look for a "security" file located on the
user's hard drive. If it finds the file, it allows the user to continue
into the application. If it doesn't find the file, the database shuts
down and does not let the user proceed.

I'm begging and pleading for help from all of you experts. I am not a
VB programmer, and I'm not so ignorant as to think I could teach myself
how to do this in the short time I have before I need to release this.

Is anyone willing to help me with this?

Nov 13 '05
11 1929
I could not agree with you more about the developer. I'm actually
married to an incredible developer (not Access), and working like this
is making me crazy. I've had no choice but to use this developer, as it
was a "directive" from my boss' boss, but I can tell you this: I'm not
happy about it.

Thank you all very much for your help. It's most appreciated.

Nov 13 '05 #11
Well the answer is using Access but try some VB script. Here is some
code you or your programmer should be able to modify if need be. If you
need to open Access Database, create module, copy, paste, these
procedures. You may change the path variable and file type. If you
don't won't to see msgbox prompts, please put a Debug.Print and open
the immediate window and you view the results, without interuption.
There is quite of bit of documentation in help files in Access VBA help
file. Good luck!

loringdo
Option Compare Database
Option Explicit

Sub FileSearchCount ()

Dim i As Integer

With Application.Fil eSearch
If .Execute() > 0 Then
MsgBox "There were " & .FoundFiles.Cou nt & _
" file(s) found."
For i = 1 To .FoundFiles.Cou nt
MsgBox .FoundFiles(i)
Next i
Else
MsgBox "There were no files found."
End If
End With
End Sub
Sub SearchSubFolder s()

With Application.Fil eSearch
.NewSearch
.LookIn = "C:\My Documents"
.SearchSubFolde rs = True
.filename = "Run"
.MatchTextExact ly = True
.FileType = msoFileTypeAllF iles
End With
End Sub

Sub SearchSubFolder sFileType()
Dim i As Integer
Dim fs
'msoFileTypeOff iceFiles
'msoFileTypeAll Files

Set fs = Application.Fil eSearch

With fs
.LookIn = "C:\My Documents"
.FileType = msoFileTypeBind ers
If .Execute > 0 Then
MsgBox "There were " & .FoundFiles.Cou nt & _
" Binder file(s) found."
For i = 1 To .FoundFiles.Cou nt
MsgBox .FoundFiles(i)
Next i
Else
MsgBox "There were no Binder files found."
End If
End With
End Sub
Sub FoundFilesCount ()
Dim i As Integer

With Application.Fil eSearch
For i = 1 To .FoundFiles.Cou nt
MsgBox .FoundFiles(i)
Next i
End With
End Sub
Sub FileSearchFolde rCount()

Dim fs
Dim i As Integer
Set fs = Application.Fil eSearch
With fs
.LookIn = "C:\DPG\Reports \122"
.filename = "*.snp"
If .Execute > 0 Then
MsgBox "There were " & .FoundFiles.Cou nt & _
" file(s) found."
For i = 1 To .FoundFiles.Cou nt
MsgBox .FoundFiles(i)
Next i
Else
MsgBox "There were no files found."
End If
End With
End Sub

Sub FileLastModifie dYeasterday()
Dim fs
Set fs = Application.Fil eSearch
With fs
.LookIn = "C:\My Documents"
.SearchSubFolde rs = True
.LastModified = msoLastModified Yesterday
End With
End Sub

Nov 13 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2349
by: Kartic | last post by:
Hello, I downloaded the Win32 installer for Twisted 1.3.0, Python 2.3. The installer, when executed under my login, fails as it requires administrator rights to install (why they have it as a requirement, I don't understand). So I started the installer as the admin user. That too failed because I have a non-admin install of Python 2.3 on my machine and when I launch
1
6907
by: Markus Ernst | last post by:
Hi I wrote a function that "normalizes" strings for use in URLs in a UTF-8 encoded content administration application. After having removed the accents from latin characters I try to remove all non-word characters from the string: // PCRE syntax: $string = preg_replace("/(+)/", "-", $string);
4
5312
by: bwmiller16 | last post by:
Guys - I'm doing a database consistency check for a client and I find that they're building unique indexes for performance/query reasons where they could be using non-unique indexes. Note that these columns in the unique indexes are truly unique and don't constitute a collision hazard of any kind. Now, I personally wouldn't use unique where non-unique would do but I
32
4528
by: Adrian Herscu | last post by:
Hi all, In which circumstances it is appropriate to declare methods as non-virtual? Thanx, Adrian.
3
2494
by: Ivan | last post by:
Hi, how to filter out non-digit chars when user writes text to System.Windows.Forms.TextBox? Thanks, Iavmn
13
2952
by: Academic | last post by:
I have a MDI form, sometimes child forms and sometimes forms that are neither If I close the app the child forms closing and closed event happens followed by the Mdi form receiving the events.. But the regular forms that are also open do not receive that event. This is true whether there are child forms open or not.
0
1458
by: Wijnand Kroes | last post by:
Hi guys, I have a C#.NET client which sends SOAP requests to .Net webservices and non ..Net webservices. If I do not add a SOAP header a get a valid response from all webservices. If I do add a SOAP header a get a valid response from the .Net webservice but an error from the client when accessing a non .Net webservice. The non .Net webservices are created in VB6 and Java.
7
1539
by: siddhu | last post by:
Dear Experts, I have a question. I wrote the following code class A { public: void g(){}
6
6480
by: Fabian Wein | last post by:
Hi, is there a way to call a const function from non const function? I have a non-const List GetList(); and want my
3
4100
by: George2 | last post by:
Hello everyone, I am debugging MSDN code from, http://msdn2.microsoft.com/en-us/library/0eestyah(VS.80).aspx here is my output, 1>main.cpp
0
9669
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
9515
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10427
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...
1
10155
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
9029
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
7537
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
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5559
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2916
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.