473,399 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

DIR() throwing run time error 52

Hi,

I am running a code to automate a report. Part of that automation is to go to share point site open up a file based on wild card section and follow on with the code.

I am using DIR() to return the exact file name based on wild card combinations.

It works fine most of the time but at some specific triggers it runs into run time error 52 right at the line where DIR() is being called.

I have to manually run that DIR() by removing the wildcard combination and actually relacing it with the exact file name to get it working again or else it would not move.

Need help with making it more stable or consistent. Can FSO solve my problem here and how?

Mentioning the code which runs into the error:

Expand|Select|Wrap|Line Numbers
  1. Public Cmbval As String
  2. Public actwbk As String
  3.  
  4. Public Sub Report()
  5.  
  6.     Dim myPath As String
  7.     Dim myFile As String
  8.     Dim fnName As String
  9.     Dim filend1 As String
  10.     Dim filend2 As String
  11.  
  12. 'Choose file name and path based on the combobox selection by the user in a form displayed as the workbook opens
  13.  
  14. Select Case Cmbval
  15.    Case Is = "Dec-15"
  16.    myPath = ("\\wbcspaces@SSL\my\teams\")
  17.    myFile = Dir("\\wbcspaces@SSL\my\teams\Rptnm2015-12-*.csv*")
  18.  
  19.    If (myFile = "") Then
  20.    MsgBox "No file found"
  21.    UserForm1.Show
  22.    Exit Sub
  23.    Else
  24.    'Do something
  25.    End If
  26.    End Select
Any help/advise is appreciated
Feb 19 '16 #1
0 1009

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

Similar topics

0
by: Miranda Evans | last post by:
I noticed several postings about issues related to "run-time error 3061", and I observed that the solutions to these issues appear to involve correcting something within the SQL code. I'm...
0
by: Robert McGregor | last post by:
Using the follwing code and getting the error message: Run time error '2455': You entered an expression that contains an invalid reference to the property MaxRecButton. My code just...
0
by: crypto_solid via AccessMonster.com | last post by:
I have been using a SQL database with a VB5 frontend for about 5 years. Works well. Unfortunately I don't have access to the source code. I was tasked with implementing a "job entry" application...
4
by: Christaaay | last post by:
I have been using the code below successfully for almost a year. yesterday, I began getting a run time error 6 (overflow). I am using the code in an Access 2000 database. Can anyone help me...
1
by: WebBuilder451 | last post by:
the following simple check for a null valuse is throwing an error If IsDBNull(Me.DsMem1.usr(0).usrCoState) Then Response.Write(STAt) End If DSMem is a dataset and the value is null. I thought...
0
by: rc | last post by:
Moved a working MS Access application from Win2000 (version 5.0 SP 3) OS with MS Access 2000 and DB2 Run-time client v7.1 FP 4 to XP (version 5.1, SP 2) OS with MS Access 2003 and DB2 Run-time...
9
by: ThunderMusic | last post by:
Hi, I'd like to create a compile time error in my class... maybe there's a way already built in in the framework so I can achieve what I want... I have 2 constructors in my class. One of them...
3
by: DontB3 | last post by:
Hi, I'm new in this forum, and i hope someone can help. I'm creating an automatic application that transfer a database from Access -> DBF -> Oracle. When My App try to execute Insert SQL...
11
by: Bryan Crouse | last post by:
I am looking a way to do error checking on a string at compile time, and if the string isn't the correct length have then have the compiler throw an error. I am working an embedded software that...
6
by: JAGster | last post by:
I don’t know VBA but have been using Access for awhile using tables, queries, forms and macros. I am trying to automate importing a number of Excel 2007 spreadsheets into an Access 2007 table. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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...

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.