|
-
Jun 6th, 2000, 02:03 AM
#1
Thread Starter
Member
I made it possible to import a file into a table with an access macro. I then converted it to VB, and made a program around it, and now i get this error.
http://home.neo.rr.com/aq2/error.jpg
all the stuff it needs for the import is there. i have no idea why this is happening, and the strange part, it that it doesnt happen everytime.
this sux, pleeze help
------------------
"Mess with the best Die like the rest" -Dade "Hackers"
-
Jun 6th, 2000, 02:24 AM
#2
Thread Starter
Member
i can post code if that will help
-
Jun 6th, 2000, 02:55 AM
#3
Thread Starter
Member
well here is the code
From Code
Option Explicit
'Assumptions
'-----------
'1. Database / Textfile / Program are in the same directory
'2. Textfile name always = mmarptcsv.txt
'3. Salesman Number = numeric value
'4. Access is installed on the computer holding the database
'5. Database is always named salesman.mdb
Private Sub Command1_Click()
Dim dbSalesman As Database
Dim dbLocation As String
Dim X As Integer
dbLocation = App.Path & "\salesman.mdb"
Set dbSalesman = OpenDatabase(dbLocation)
'Update Database
Module1.Go
'Close Database
dbSalesman.Close
MsgBox "Update Complete", vbInformation
'Open Database for deletion of table
Set dbSalesman = OpenDatabase(dbLocation)
'Delete table "mmarptcsv_ImportErrors, only if it exists
For X = 0 To dbSalesman.TableDefs.Count - 1
If dbSalesman.TableDefs(X).Name = "mmarptcsv_ImportErrors" Then Module1.delete_errors
Next
'Close database
dbSalesman.Close
End Sub
Private Sub Command2_Click()
Set Form1 = Nothing
Unload Me
End Sub
Module Code
Option Explicit
Function Go()
On Error GoTo Go_Err
Dim sFile As String
sFile = App.Path & "\mmarptcsv.txt"
DoCmd.SetWarnings False
DoCmd.TransferText acImportDelim, "Mmarptcsv Import Specification", "Mmarptcsv", sFile, False, ""
DoCmd.OpenQuery "Delete", acNormal, acEdit
DoCmd.OpenQuery "append", acNormal, acEdit
DoCmd.OpenQuery "clear errors", acNormal, acEdit
DoCmd.OpenQuery "clear temp", acNormal, acEdit
DoCmd.SetWarnings True
Go_Exit:
Exit Function
Go_Err:
MsgBox Error$
Resume Go_Exit
End Function
Function delete_errors()
On Error GoTo delete_errors_Err
DoCmd.DeleteObject acTable, "mmarptcsv_ImportErrors"
delete_errors_Exit:
Exit Function
delete_errors_Err:
MsgBox Error$
Resume delete_errors_Exit
End Function
-
Jun 6th, 2000, 03:27 AM
#4
Thread Starter
Member
when the database is open in access, and i run this, it works fine, but when the database is closed, it only periodically werks!!!!
HELP!!!!
-
Jun 6th, 2000, 03:35 AM
#5
Thread Starter
Member
how could i invoke the access macro from in VB, w/o converting the macro to a vb macro?
-
Jun 6th, 2000, 03:44 AM
#6
Thread Starter
Member
ok you cant invoke it,
damn i love how ppl reply to the topics on this board, its soooooo helpful!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|