G
Guest
The visual basic code I have imputed will not run. The seventh line of
code,"Dim dbs As Database" is highlighted, and the message, "Compile Error:
User-defined type not defined" appears.
If anyone has any ideas, I'd appretiate it.
Option Compare Database
Option Explicit
Dim strSymbol As String
Dim dteLineDate As Date
Dim intRef As Integer
Dim strSQL As String
Dim dbs As Database
Dim rst As Recordset
Private Sub CopyData()
On Error GoTo Err_CopyData
strSymbol = InputBox("Enter Symbol Code:")
intRef = -63
dteLineDate = DMin("[DATE]", "[RAW DATA]", "[SYMBOL] = strSymbol")
While intRef < -51
strSQL = "INSERT INTO INTERMEDIATE (SYMBOL, DATE, HIGH, " & _
"LOW, LAST, VOLUME) SELECT [RAW DATA].SYMBOL, " & _
"[RAW DATA].DATE, [RAW DATA].HIGH, [RAW DATA].LOW, " & _
"WHERE (([RAW DATA].SYMBOL = strSymbol) " & _
"AND ([RAW DATA].DATE = dteLineDate))"
DoCmd.RunSQL strSQL
intRef = intRef + 1
NextDate:
dteLineDate = dteLineDate + 1
strSQL = "SELECT * FROM [RAW DATA] WHERE " & _
"(([DATE] = dteLineDate) AND ([SYMBOL] = strSymbol))"
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(strSQL)
If DCount("*", rst) = 0 Then
Set rst = Nothing
Set dbs = Nothing
GoTo NextDate
Else
Set rst = Nothing
Set dbs = Nothing
End If
Wend
Exit Sub
Err_CopyData:
MsgBox Err.Description
Exit Sub
End Sub
code,"Dim dbs As Database" is highlighted, and the message, "Compile Error:
User-defined type not defined" appears.
If anyone has any ideas, I'd appretiate it.
Option Compare Database
Option Explicit
Dim strSymbol As String
Dim dteLineDate As Date
Dim intRef As Integer
Dim strSQL As String
Dim dbs As Database
Dim rst As Recordset
Private Sub CopyData()
On Error GoTo Err_CopyData
strSymbol = InputBox("Enter Symbol Code:")
intRef = -63
dteLineDate = DMin("[DATE]", "[RAW DATA]", "[SYMBOL] = strSymbol")
While intRef < -51
strSQL = "INSERT INTO INTERMEDIATE (SYMBOL, DATE, HIGH, " & _
"LOW, LAST, VOLUME) SELECT [RAW DATA].SYMBOL, " & _
"[RAW DATA].DATE, [RAW DATA].HIGH, [RAW DATA].LOW, " & _
"WHERE (([RAW DATA].SYMBOL = strSymbol) " & _
"AND ([RAW DATA].DATE = dteLineDate))"
DoCmd.RunSQL strSQL
intRef = intRef + 1
NextDate:
dteLineDate = dteLineDate + 1
strSQL = "SELECT * FROM [RAW DATA] WHERE " & _
"(([DATE] = dteLineDate) AND ([SYMBOL] = strSymbol))"
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(strSQL)
If DCount("*", rst) = 0 Then
Set rst = Nothing
Set dbs = Nothing
GoTo NextDate
Else
Set rst = Nothing
Set dbs = Nothing
End If
Wend
Exit Sub
Err_CopyData:
MsgBox Err.Description
Exit Sub
End Sub