473,395 Members | 1,978 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,395 software developers and data experts.

Stuck with Run Time Error 2455

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 searches the directory where the database is and imports
the csv files it finds there. Debug on the error takes me to the line:

DoCmd.TransferText acImportDelim, "FileImport", "tblFiles",
strfullname, False

Any ideas what is causing this error???

Thanks,

Rob.

***Code Block***

Private Sub Command0_Click()

Dim db As DAO.Database, rs1 As DAO.Recordset, rs2 As DAO.Recordset,
rs3 As DAO.Recordset
Dim strfilename As String
Dim strfullname As String, mysql As String, strmsg As String, docase
As Integer

'***Set up variables
Set db = CurrentDb
Set rs1 = db.OpenRecordset("tblFiles")
Set rs2 = db.OpenRecordset("tblFilesLoaded")

'***Find first file
strfilename = Dir("C:/Documents and
Settings/rmcgrego/Desktop/audit2/*.csv")
strfullname = "C:/Documents and Settings/rmcgrego/Desktop/audit2/"
& strfilename

'***Loop until no files left
Do Until strfilename = ""

'***Case check file is not already loaded
'set up new record source that is a query based on the filename
returned by Dir
mysql = "select all * from tblFilesLoaded where filename='" &
strfilename & "'"
Set rs3 = db.OpenRecordset(mysql, dbOpenSnapshot)

'check if file is already listed in the record source
If rs3.RecordCount > 0 Then
docase = 0
Else
docase = 1
End If

'***Start new case select
Select Case docase

'***Case loaded - error message
Case 0

strmsg = "File - " & strfilename & " - already loaded on " &
rs3![dateloaded]
strmsg = strmsg & ". Check files you are trying to load and
run again if necessary."
MsgBox strmsg, vbOKOnly
strfilename = Dir

'***Case not loaded - load file
Case 1

SysCmd acSysCmdSetStatus, "Loading file " & strfilename
DoCmd.TransferText acImportDelim, "FileImport", "tblFiles",
strfullname, False
SysCmd acSysCmdSetStatus, "Completed loading " & strfilename

rs2.AddNew
rs2![FileName] = strfilename
rs2.Update

'***Move file to completed directory
FileCopy strfullname, "C:/Documents and
Settings/rmcgrego/Desktop/audit2/processed/" & strfilename
Kill (strfullname)

'***End Case
End Select

strfilename = Dir("C:/Documents and
Settings/rmcgrego/Desktop/audit2/*.csv")
strfullname = "C:/Documents and Settings/rmcgrego/Desktop/audit2/"
& strfilename

'Return to loop until all files processed
Loop

SysCmd acSysCmdClearStatus

End Sub
Nov 13 '05 #1
0 4099

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

Similar topics

12
by: Grahammer | last post by:
For some reason I am getting an error when trying to open a recordset on an Access database on my Win2K3 machine from my INDEX.ASP page, but the same code accesses the database fine when coming...
8
by: middletree | last post by:
What's wrong with this code? strLongDesc = Replace(Replace(Replace(Replace(Trim(Request.Form("LongDesc")),"'","''"),vbC rLf,"<br>"),"<",&lt;),"<",&gt;) Background: This field is a textarea, and I...
3
by: Annelies | last post by:
Hi, I want to set the recordsource of a subform to a query with this syntax : Forms!Form_patient!sub75.form.recordsource="MyQueryName" the problem is after typing sub75. I get a list of...
0
by: Vladislav Moltchanov | last post by:
Any idea, what could be reason for the following effect. Code developed in acc97 generates RunTime Error 2455 in Access 2000: claiming the Name reference is wrong: ctlLabel.Name In the SUB:...
3
by: lauren quantrell | last post by:
I have an Access 2000 form that I open showing only the header. The form's detail section visible property is set to false. The detail section contains a subform. Using a command button, I use the...
8
by: MLH | last post by:
I use a mouse-down procedure to trap right mouse clicks and CTRL-Right mouse clicks. Running the procedure must put honey or some other sticky substance into my keyboard because subsequent...
0
by: salad | last post by:
The 2455 error starts out with something like "You entered an expression that has an invalid reference..." Going to Google the general impression was that a reference was missing. At MS, there's...
6
by: Keith Wilby | last post by:
Why do I get this error when I run this code from a report's open event? strSQL = "Select * from qsrptCaveat" If Forms!fdlgPrint!chkInclude = False Then strSQL = strSQL & " Where = 0"...
3
by: iwasinnihon | last post by:
I have created a form that has a list box that displays information queried from a table. I then have a textbox under the form and three buttons under that(Add, Update, Delete). When the form is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.