R
R Erskine
I am trying to write a routine to pull a variable string
from a table that has only one record. I am getting a
type mismatch error, any ideas why?
'--------------------------------------------------------
' Import Client Records to ImportTable
'
'--------------------------------------------------------
Function ImportClient()
On Error GoTo ImportClient_Err
Call Test
' Import Client.txt File to ImportTable
DoCmd.TransferText
acImportDelim, "ClientImportSpecs", "ImportTable", "StrSQL
", True, ""
ImportClient_Exit:
Exit Function
ImportClient_Err:
MsgBox Error$
Resume ImportClient_Exit
End Function
'---------------------------------------------------------
' Routine to Call Import File Path Variable
'
'---------------------------------------------------------
Sub Test()
Dim Dbs As Database
Dim RstTest As Recordset
Dim StrSQL As String
Set Dbs = CurrentDb
StrSQL = "SELECT ImpFilePath FROM VariableData"
Set RstTest = Dbs.OpenRecordset(StrSQL)
If Not RstTest.BOF And Not RstTest.EOF Then
MsgBox "File path is " & RstTest!filepath
End If
Proc_Exit:
' Destroy Objects
Set Dbs = Nothing
Set RstTest = Nothing
End Sub
from a table that has only one record. I am getting a
type mismatch error, any ideas why?
'--------------------------------------------------------
' Import Client Records to ImportTable
'
'--------------------------------------------------------
Function ImportClient()
On Error GoTo ImportClient_Err
Call Test
' Import Client.txt File to ImportTable
DoCmd.TransferText
acImportDelim, "ClientImportSpecs", "ImportTable", "StrSQL
", True, ""
ImportClient_Exit:
Exit Function
ImportClient_Err:
MsgBox Error$
Resume ImportClient_Exit
End Function
'---------------------------------------------------------
' Routine to Call Import File Path Variable
'
'---------------------------------------------------------
Sub Test()
Dim Dbs As Database
Dim RstTest As Recordset
Dim StrSQL As String
Set Dbs = CurrentDb
StrSQL = "SELECT ImpFilePath FROM VariableData"
Set RstTest = Dbs.OpenRecordset(StrSQL)
If Not RstTest.BOF And Not RstTest.EOF Then
MsgBox "File path is " & RstTest!filepath
End If
Proc_Exit:
' Destroy Objects
Set Dbs = Nothing
Set RstTest = Nothing
End Sub