Good day,
I'm currently trying to print the data in my database using Visual Basic but I have a little problem with the codes, need your help about figuring out what I might be missing. I keep on getting the same error
Run-time error '-2147217900 (80040e14)'
[CODE=vb]Dim adoHistoryPrint As New ADODB.Connectio n
Dim recHistoryPrint As New ADODB.Recordset
Dim cmdHistoryPrint As New ADODB.Command
Dim rsHistoryPrint As New ADODB.Recordset
Private Sub cmdPrintReceivi ngHistory_Click ()
Dim i As Integer
adoHistoryPrint .Open "Provider=SQLOL EDB.1;Password= Pword;Persist Security Info=True;User ID=User;Initial Catalog=DBase;D ata Source=DATABASE "
With cmdHistoryPrint
.ActiveConnecti on = adoHistoryPrint
.CommandType = adCmdText
.CommandText = " SHAPE {" & adoReceivingHis tory.RecordSour ce & "} AS Command1 COMPUTE Command1 BY 'ItemType'"
.Execute
End With
With recHistoryPrint
.ActiveConnecti on = adoHistoryPrint
.CursorLocation = adUseClient
.Open cmdHistoryPrint
End With
With rptReceivingHis tory
Set .DataSource = Nothing
.DataMember = ""
Set .DataSource = rsHistoryPrint
With .Sections("Item Type").Controls
For i = 1 To .Count
If TypeOf .Item(i) Is RptTextBox Then
.Item(i).DataMe mber = ""
.Item(i).DataFi eld = "ItemType"
End If
Next i
End With
With .Sections("Rece ivingDetails"). Controls
For i = 1 To .Count
If TypeOf .Item(i) Is RptTextBox Then
.Item(i).DataMe mber = ""
End If
Next i
End With
.Show
End With
End Sub[/CODE]
I'm currently trying to print the data in my database using Visual Basic but I have a little problem with the codes, need your help about figuring out what I might be missing. I keep on getting the same error
Run-time error '-2147217900 (80040e14)'
[CODE=vb]Dim adoHistoryPrint As New ADODB.Connectio n
Dim recHistoryPrint As New ADODB.Recordset
Dim cmdHistoryPrint As New ADODB.Command
Dim rsHistoryPrint As New ADODB.Recordset
Private Sub cmdPrintReceivi ngHistory_Click ()
Dim i As Integer
adoHistoryPrint .Open "Provider=SQLOL EDB.1;Password= Pword;Persist Security Info=True;User ID=User;Initial Catalog=DBase;D ata Source=DATABASE "
With cmdHistoryPrint
.ActiveConnecti on = adoHistoryPrint
.CommandType = adCmdText
.CommandText = " SHAPE {" & adoReceivingHis tory.RecordSour ce & "} AS Command1 COMPUTE Command1 BY 'ItemType'"
.Execute
End With
With recHistoryPrint
.ActiveConnecti on = adoHistoryPrint
.CursorLocation = adUseClient
.Open cmdHistoryPrint
End With
With rptReceivingHis tory
Set .DataSource = Nothing
.DataMember = ""
Set .DataSource = rsHistoryPrint
With .Sections("Item Type").Controls
For i = 1 To .Count
If TypeOf .Item(i) Is RptTextBox Then
.Item(i).DataMe mber = ""
.Item(i).DataFi eld = "ItemType"
End If
Next i
End With
With .Sections("Rece ivingDetails"). Controls
For i = 1 To .Count
If TypeOf .Item(i) Is RptTextBox Then
.Item(i).DataMe mber = ""
End If
Next i
End With
.Show
End With
End Sub[/CODE]
Comment