Used SQL Upsizing Wizard, Application No Longer Runs | | |
Excuse any errors in my description of the problem, as I'm only an
amateur with Access.
I've just created a simple VB application in A2000 that imports a text
file into a table, and works fine. I then used the Microsoft Upsizing
Wizard to create a new SQL database with an MS Access 2000 back end,
and guess what, it not longer works, but stops at the line
db.TableDefs.Delete ("tblData")
The code to the point where it 'stops' is as follows:
Dim objFile As TextFile
' Create new instance of TextFile class
Set objFile = New TextFile
' Set the Path property
objFile.Path = Trim(strDataInputFile.strFile)
strDataOutputFile = "c:\acag\temp\" & Mid(strDataInputFile.strFile, 15,
Len(Trim(strDataInputFile.strFile)) - 14)
Open strDataOutputFile For Output As 1
strDataErrorFile = "c:\acag\temp\Errors_Data.txt"
Open strDataErrorFile For Output As 2
Dim db As Database
Dim rstData As Recordset
Set db = CurrentDb
' delete previous table
db.TableDefs.Delete ("tblData")
Can anyone put me on the right track please.
-cicada- | | | | re: Used SQL Upsizing Wizard, Application No Longer Runs
"-cicada-" <johnfurphy@a1.com.au> wrote in message
news:1128421787.343299.183000@o13g2000cwo.googlegr oups.com...[color=blue]
> Excuse any errors in my description of the problem, as I'm only an
> amateur with Access.
>
> I've just created a simple VB application in A2000 that imports a text
> file into a table, and works fine. I then used the Microsoft Upsizing
> Wizard to create a new SQL database with an MS Access 2000 back end,
> and guess what, it not longer works, but stops at the line
>
> db.TableDefs.Delete ("tblData")
>
> The code to the point where it 'stops' is as follows:
>
> Dim objFile As TextFile
> ' Create new instance of TextFile class
> Set objFile = New TextFile
> ' Set the Path property
> objFile.Path = Trim(strDataInputFile.strFile)
> strDataOutputFile = "c:\acag\temp\" & Mid(strDataInputFile.strFile, 15,
> Len(Trim(strDataInputFile.strFile)) - 14)
> Open strDataOutputFile For Output As 1
> strDataErrorFile = "c:\acag\temp\Errors_Data.txt"
> Open strDataErrorFile For Output As 2
> Dim db As Database
> Dim rstData As Recordset
> Set db = CurrentDb
> ' delete previous table
> db.TableDefs.Delete ("tblData")
>
> Can anyone put me on the right track please.
>
> -cicada-[/color]
What error do you get? Does tblData exist and if so, is it a linked table?
Or perhaps you are trying to delete the actual SQL Server table, rather than
the Access linked table. | | | | re: Used SQL Upsizing Wizard, Application No Longer Runs
Brian,
The error message is 'Path Not Found'
Yes, tblData does exist. In MS Access it shows in the Database window
under the table tab, but does not have the arrow next to it, to
indicate it is a linked table, as is usually the case. The table is
also listed in the SQL database, so having it listed in two databases,
without any indication of linking has confused me.
John Furphy
Brian Wilson wrote:[color=blue]
> "-cicada-" <johnfurphy@a1.com.au> wrote in message
> news:1128421787.343299.183000@o13g2000cwo.googlegr oups.com...[color=green]
> > Excuse any errors in my description of the problem, as I'm only an
> > amateur with Access.
> >
> > I've just created a simple VB application in A2000 that imports a text
> > file into a table, and works fine. I then used the Microsoft Upsizing
> > Wizard to create a new SQL database with an MS Access 2000 back end,
> > and guess what, it not longer works, but stops at the line
> >
> > db.TableDefs.Delete ("tblData")
> >
> > The code to the point where it 'stops' is as follows:
> >
> > Dim objFile As TextFile
> > ' Create new instance of TextFile class
> > Set objFile = New TextFile
> > ' Set the Path property
> > objFile.Path = Trim(strDataInputFile.strFile)
> > strDataOutputFile = "c:\acag\temp\" & Mid(strDataInputFile.strFile, 15,
> > Len(Trim(strDataInputFile.strFile)) - 14)
> > Open strDataOutputFile For Output As 1
> > strDataErrorFile = "c:\acag\temp\Errors_Data.txt"
> > Open strDataErrorFile For Output As 2
> > Dim db As Database
> > Dim rstData As Recordset
> > Set db = CurrentDb
> > ' delete previous table
> > db.TableDefs.Delete ("tblData")
> >
> > Can anyone put me on the right track please.
> >
> > -cicada-[/color]
>
>
>
> What error do you get? Does tblData exist and if so, is it a linked table?
> Or perhaps you are trying to delete the actual SQL Server table, rather than
> the Access linked table.[/color] | | | | re: Used SQL Upsizing Wizard, Application No Longer Runs
"-cicada-" <johnfurphy@a1.com.au> wrote in message
news:1128473174.203866.110980@f14g2000cwb.googlegr oups.com...[color=blue]
> Brian,
>
> The error message is 'Path Not Found'
>
> Yes, tblData does exist. In MS Access it shows in the Database window
> under the table tab, but does not have the arrow next to it, to
> indicate it is a linked table, as is usually the case. The table is
> also listed in the SQL database, so having it listed in two databases,
> without any indication of linking has confused me.
>
>
> John Furphy
>
> Brian Wilson wrote:[color=green]
>> "-cicada-" <johnfurphy@a1.com.au> wrote in message
>> news:1128421787.343299.183000@o13g2000cwo.googlegr oups.com...[color=darkred]
>> > Excuse any errors in my description of the problem, as I'm only an
>> > amateur with Access.
>> >
>> > I've just created a simple VB application in A2000 that imports a text
>> > file into a table, and works fine. I then used the Microsoft Upsizing
>> > Wizard to create a new SQL database with an MS Access 2000 back end,
>> > and guess what, it not longer works, but stops at the line
>> >
>> > db.TableDefs.Delete ("tblData")
>> >
>> > The code to the point where it 'stops' is as follows:
>> >
>> > Dim objFile As TextFile
>> > ' Create new instance of TextFile class
>> > Set objFile = New TextFile
>> > ' Set the Path property
>> > objFile.Path = Trim(strDataInputFile.strFile)
>> > strDataOutputFile = "c:\acag\temp\" & Mid(strDataInputFile.strFile, 15,
>> > Len(Trim(strDataInputFile.strFile)) - 14)
>> > Open strDataOutputFile For Output As 1
>> > strDataErrorFile = "c:\acag\temp\Errors_Data.txt"
>> > Open strDataErrorFile For Output As 2
>> > Dim db As Database
>> > Dim rstData As Recordset
>> > Set db = CurrentDb
>> > ' delete previous table
>> > db.TableDefs.Delete ("tblData")
>> >
>> > Can anyone put me on the right track please.
>> >
>> > -cicada-[/color]
>>
>>
>>
>> What error do you get? Does tblData exist and if so, is it a linked
>> table?
>> Or perhaps you are trying to delete the actual SQL Server table, rather
>> than
>> the Access linked table.[/color][/color]
If all the tables should be in the SQL database, then the local table
shouldn't be there - so just manually delete it. Normally there should be
no need to delete the table, you can just delete all the records in it, but
if you really need to delete the table, you should make sure the table
exists with the function shown below.
If you need to delete a SQL Server table from an mdb file, then that is a
different matter. Let us know if you need code for that.
Function TableExists(strTableName As String) As Boolean
On Error GoTo Err_Handler
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Set dbs = CurrentDb
For Each tdf In dbs.TableDefs
If tdf.Name = strTableName Then
TableExists = True
Exit For
End If
Next tdf
Exit_Handler:
On Error Resume Next
Set tdf = Nothing
Set dbs = Nothing
Exit Function
Err_Handler:
MsgBox Err.Description, vbExclamation, "Error No: " & Err.Number
Resume Exit_Handler
End Function |  | Similar Microsoft Access / VBA bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,223 network members.
|