Records not showing in report

J

J Arty

Hello,

I run this code to import texte files to a table named OrdenesTbl....

DoCmd.TransferText acImportDelim, SCHEMA, "Ordenestbl", MyPath
& "ordenes.txt"

'Copies all new records to table OrderrecievedTbl
from table OrdenesTbl
Set cmd = New ADODB.Command
With cmd
Set .ActiveConnection = CNN
.CommandType = adCmdStoredProc
.CommandText = "CopyfOrdenestoOrderN"
Set prm1 = .CreateParameter("Date", adDate,
adParamInput, , FDate)
.Parameters.Append prm1
Set prm2 = .CreateParameter("Time", adInteger,
adParamInput, , FNum)
.Parameters.Append prm2
.Execute 'LrecordsAffected, ,
ADODB.adExecuteNoRecords
End With

'Updates all changed records in table
OrderrecievedTbl from table OrdenesTbl
Set cmd = New ADODB.Command
With cmd
Set .ActiveConnection = CNN
.CommandType = adCmdStoredProc
.CommandText = "CopyfOrdenestoOrderC"
Set prm1 = .CreateParameter("Date", adDate,
adParamInput, , FDate)
.Parameters.Append prm1
Set prm2 = .CreateParameter("Time", adInteger,
adParamInput, , FNum)
.Parameters.Append prm2
.Execute 'LrecordsAffected, ,
ADODB.adExecuteNoRecords
End With

'Updates all Void records in table OrderrecievedTbl
from table OrdenesTbl
Set cmd = New ADODB.Command
With cmd
Set .ActiveConnection = CNN
.CommandType = adCmdStoredProc
.CommandText = "CopyfOrdenestoOrderV"
Set prm1 = .CreateParameter("Date", adDate,
adParamInput, , FDate)
.Parameters.Append prm1
Set prm2 = .CreateParameter("Time", adInteger,
adParamInput, , FNum)
.Parameters.Append prm2
.Execute 'LrecordsAffected, ,
ADODB.adExecuteNoRecords
End With


'Updates allrecords change by parent company in
table OrderrecievedTbl from table OrdenesTbl
Set cmd = New ADODB.Command
With cmd
Set .ActiveConnection = CNN
.CommandType = adCmdStoredProc
.CommandText = "CopyfOrdenestoOrderU"
Set prm1 = .CreateParameter("Date", adDate,
adParamInput, , FDate)
.Parameters.Append prm1
Set prm2 = .CreateParameter("Time", adInteger,
adParamInput, , FNum)
.Parameters.Append prm2
.Execute 'LrecordsAffected, ,
ADODB.adExecuteNoRecords
End With

' Deletes records from OrdenesTbl
Set cmd = New ADODB.Command
With cmd
Set .ActiveConnection = CNN
.CommandType = adCmdStoredProc
.CommandText = "DeleteAOrdenes"
.Execute 'LrecordsAffected, ,
ADODB.adExecuteNoRecords
End With


' Add Name of file impoted to prevent from importing
more than once
Set cmd = New ADODB.Command
With cmd
Set .ActiveConnection = CNN
.CommandType = adCmdStoredProc
.CommandText = "UpdateFileName"
Set prm = .CreateParameter("Fname", adChar,
adParamInput, 12, filenameA)
.Parameters.Append prm
.Execute 'LrecordsAffected, ,
ADODB.adExecuteNoRecords
End With

' Renames file ordenes to file name sent by UNO
MyPath = "C:\WINDOWS\JGN\" 'Set Path
MyName = Dir(MyPath, vbDirectory)
MyFile = Dir("C:\WINDOWS\JGN\ordenes.txt")
MyName1 = filenameA
Name MyPath & "ordenes.txt" As MyPath & MyName1
Kill ("C:\WINDOWS\jgn\" & filenameA)
End If
'CNN.Close
If Dir(SFile) <> "" Then Kill strFile
'
My problem is this, sometime after the user has imported the files, some
records do not show up in the report "Print orders imported"..... The
records are in the table in the access project but the report does not show
them....
If the user imports for example: 04102201.txt witch has 4 records, then
04102202.txt witch has 2 records.... and then goes to print the records
imported, only the ones for the first imported file shows....

Here is the code I use to get the info for the report:

Private Sub btnOk_Click()

Dim strDocName, strDocName1 As String

If IsNull(Me.Num.Value) Then
strDocName = "Receipt3"

DoCmd.OpenReport strDocName, acViewDesign
Reports!Receipt3.RecordSource = "select * FROM OrderReceivedTbl" _
& " where Dater >= '" _
& Me.Datef.Value & "' AND Dater <= '" _
& Me.Datet.Value & "'ORDER BY OrderNumber"
DoCmd.OpenReport strDocName, acViewPreview
Else
strDocName1 = "Receipt3"

DoCmd.OpenReport strDocName1, acViewDesign
Reports!Receipt3.RecordSource = "select * FROM OrderReceivedTbl" _
& " where Dater >= '" _
& Me.Datef.Value & "' AND Dater <= '" _
& Me.Datet.Value & "'AND Num = '" _
& Me.Num.Value & "'ORDER BY OrderNumber"
DoCmd.OpenReport strDocName1, acViewPreview
End If
end sub

Any help would be greatly appreciated....

J
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top