twinupshot
Registered User.
- Local time
- Today, 00:23
- Joined
- Jan 10, 2002
- Messages
- 22
I recently recieved a database that develops an ODBC error 3146 when the VB form opens. The debugger halts on the Call RegisterDatabase line as seen below. I believe I have the Microsoft Text Driver setup inproperly in the ODBC data sources dialog box in the control panel because I know this form worked on a 3rd party's machine. I do not understand the "Call" of RegisterDatabase so I reallly don't know where to look for the error.
This form apparantly gets its info from an .mdb table that is linked to Excel (.csv) in comma seperated format.
Any thoughts on what to try next would be appreciated; as for now I'm stuck.
Bryan
Private Sub UserForm_Activate()
Dim dbSource As Database
Dim rsSource As Recordset
smpath = Documents("Doc2.doc").Path
Call RegisterDatabase("TextCard", "Microsoft Text Driver (*.txt; *.csv)", True, "FIL=text")
Set dbSource = DBEngine.Workspaces(0).OpenDatabase(smpath & "\Cards.mdb")
dbSource.TableDefs("Cards").Connect = "Text;DATABASE=" & smpath
dbSource.TableDefs("Cards").RefreshLink
Set rsSource = dbSource.OpenRecordset("Cards")
With lsvCardList.ColumnHeaders
.Add Text:="Task Card", Width:=80
.Add Text:="Doc No.", Width:=50
.Add Text:="Title", Width:=142
End With
If Not rsSource.BOF And Not rsSource.EOF Then
rsSource.MoveFirst
Do
With lsvCardList.ListItems.Add
.Text = rsSource!SCHD
.SubItems(1) = rsSource!CARD
.SubItems(2) = rsSource!TITL
End With
rsSource.MoveNext
Loop Until rsSource.EOF
End If
This form apparantly gets its info from an .mdb table that is linked to Excel (.csv) in comma seperated format.
Any thoughts on what to try next would be appreciated; as for now I'm stuck.
Bryan
Private Sub UserForm_Activate()
Dim dbSource As Database
Dim rsSource As Recordset
smpath = Documents("Doc2.doc").Path
Call RegisterDatabase("TextCard", "Microsoft Text Driver (*.txt; *.csv)", True, "FIL=text")
Set dbSource = DBEngine.Workspaces(0).OpenDatabase(smpath & "\Cards.mdb")
dbSource.TableDefs("Cards").Connect = "Text;DATABASE=" & smpath
dbSource.TableDefs("Cards").RefreshLink
Set rsSource = dbSource.OpenRecordset("Cards")
With lsvCardList.ColumnHeaders
.Add Text:="Task Card", Width:=80
.Add Text:="Doc No.", Width:=50
.Add Text:="Title", Width:=142
End With
If Not rsSource.BOF And Not rsSource.EOF Then
rsSource.MoveFirst
Do
With lsvCardList.ListItems.Add
.Text = rsSource!SCHD
.SubItems(1) = rsSource!CARD
.SubItems(2) = rsSource!TITL
End With
rsSource.MoveNext
Loop Until rsSource.EOF
End If