D
DONNA
The value I need inserted into FIELD is: TRS*T3*105*081031
The value that is inserted into FIELD after running the code:
TFS*T3*"105"*"081031 (notice the extra quote marks)
Also receiving the message: Invalid use of Null
What am I doing wrong? Thanks for your help.
THE CODE:
Private Sub Command17_Click()
On Error GoTo Err_Command17_Click
Dim LineCount As Variant
Dim tmpReferenceNumber As String
Dim tmpDate As String
Dim linedata As String
Dim linedata1 As String
DoCmd.OpenQuery "Clear Formated Detail Information"
LineCount = 2
Set dbCurrent = CurrentDb
strSQL = "SELECT * FROM [Detail Table];"
Set rsTemp = dbCurrent.OpenRecordset(strSQL)
If rsTemp.RecordCount > 0 Then
Do Until rsTemp.EOF
tmpReferenceNumber = rsTemp.Fields(0)
tmpDate = rsTemp.Fields(1)
linedata = "TFS*T3*"
linedata1 = "*"
DoCmd.RunSQL "INSERT INTO [Formated Detail Information](FIELD)
SELECT (""" & linedata & """""" & tmpReferenceNumber & """""" & linedata1 &
"""""" & tmpDate & """) AS FIELD;"
LineCount = LineCount + 1
rsTemp.MoveNext
Loop
End If
Exit_Command17_Click:
Exit Sub
Err_Command17_Click:
MsgBox Err.Description
Resume Exit_Command17_Click
End Sub
The value that is inserted into FIELD after running the code:
TFS*T3*"105"*"081031 (notice the extra quote marks)
Also receiving the message: Invalid use of Null
What am I doing wrong? Thanks for your help.
THE CODE:
Private Sub Command17_Click()
On Error GoTo Err_Command17_Click
Dim LineCount As Variant
Dim tmpReferenceNumber As String
Dim tmpDate As String
Dim linedata As String
Dim linedata1 As String
DoCmd.OpenQuery "Clear Formated Detail Information"
LineCount = 2
Set dbCurrent = CurrentDb
strSQL = "SELECT * FROM [Detail Table];"
Set rsTemp = dbCurrent.OpenRecordset(strSQL)
If rsTemp.RecordCount > 0 Then
Do Until rsTemp.EOF
tmpReferenceNumber = rsTemp.Fields(0)
tmpDate = rsTemp.Fields(1)
linedata = "TFS*T3*"
linedata1 = "*"
DoCmd.RunSQL "INSERT INTO [Formated Detail Information](FIELD)
SELECT (""" & linedata & """""" & tmpReferenceNumber & """""" & linedata1 &
"""""" & tmpDate & """) AS FIELD;"
LineCount = LineCount + 1
rsTemp.MoveNext
Loop
End If
Exit_Command17_Click:
Exit Sub
Err_Command17_Click:
MsgBox Err.Description
Resume Exit_Command17_Click
End Sub