Please could someone advise me as to why I am getting a error across a network on the following code? If I execute the code on a standalone machine there is no problem and it runs perfectly. When I try run it from another machine I get the followng error : (obviously the windows screen pops up "we have encountered an error and need to close") with this message : "Error signature modname:rpcrt4. dll" Please could someone assist?
Thanks Werner
[code=vb]
Private Sub Command2_Click( )
DeleteFile App.Path & "\data\Report\1 .xls"
'first
Command2.Visibl e = False
If Not Len(Text9.Text) < 1 Then
Adodc1.Connecti onString = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source= " + App.Path + "\data\adodb1.m db"
Set DataGrid1.DataS ource = Adodc1
SorSor = False
Adodc1.Recordse t.Update
Text1.Enabled = 0: Text2.Enabled = 0: Text3.Enabled = 0
Text4.Enabled = 0: Text5.Enabled = 0: Text6.Enabled = 0
Text7.Enabled = 0
Toolbar1.Button s.Item(1).Capti on = "New"
Toolbar1.Button s.Item(4).Enabl ed = True
End If
Dim cn As New ADODB.Connectio n
Dim oSchema As ADODB.Recordset
Dim rs As New ADODB.Recordset
Dim intFldCnt As Integer
Dim I As Integer
Dim j As Integer
Dim sngColWid As Single
Screen.MousePoi nter = vbHourglass
strDBName = App.Path & "\" & "\data\adodb1.m db"
cn.ConnectionSt ring = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" & strDBName & ";Persist Security Info=False"
cn.Open (strDBName)
Set oSchema = cn.OpenSchema(a dSchemaTables)
Set Excel = New Excel.Applicati on
Set eWorkBook = Excel.Workbooks .Add
Do Until oSchema.EOF
If InStr(oSchema!t able_name, "MSys") = 0 Then
Set eWorkSheet = eWorkBook.Works heets.Add
If InStr(oSchema!t able_name, "/") <> 0 Then
eWorkSheet.Name = Replace(oSchema !table_name, "/", "-")
End If
rs.Open "select * from [" & oSchema!table_n ame & "]", cn
intFldCnt = rs.Fields.Count - 1
For I = 1 To intFldCnt
eWorkSheet.Cell s(1, I) = rs.Fields(I).Na me
If TextWidth(rs.Fi elds(I).Name) > sngColWid Then
sngColWid = TextWidth(rs.Fi elds(I).Name)
End If
Next I
eWorkSheet.Rang e("A1", "h1").Font. Bold = True
eWorkSheet.Rang e("h1", "h1").Font.Unde rline = True
eWorkSheet.Rang e("a1:e1500").H orizontalAlignm ent = "3"
eWorkSheet.Rang e("g1:g1500").H orizontalAlignm ent = "3"
eWorkSheet.Rang e("f1:f1500").H orizontalAlignm ent = "2"
eWorkSheet.Cell s(1, 1) = "Entry"
eWorkSheet.Cell s(1, 2) = "Project"
eWorkSheet.Cell s(1, 3) = "VAT"
eWorkSheet.Cell s(1, 4) = "Cost Code"
eWorkSheet.Cell s(1, 5) = "Date / Ref"
eWorkSheet.Cell s(1, 6) = "Descriptio n"
eWorkSheet.Cell s(1, 7) = "Amount"
eWorkSheet.Cell s(1, 8) = Label5.Caption
eWorkSheet.Colu mns(1).ColumnWi dth = "7"
eWorkSheet.Colu mns(2).ColumnWi dth = "10"
eWorkSheet.Colu mns(3).ColumnWi dth = "10"
eWorkSheet.Colu mns(4).ColumnWi dth = "10"
eWorkSheet.Colu mns(5).ColumnWi dth = "15"
eWorkSheet.Colu mns(6).ColumnWi dth = "50"
eWorkSheet.Colu mns(7).ColumnWi dth = "15"
eWorkSheet.Colu mns(8).ColumnWi dth = "12"
j = 2
Do Until rs.EOF
For I = 1 To intFldCnt
eWorkSheet.Cell s(j, I) = rs.Fields(I).Va lue
Next I
j = j + 1
rs.MoveNext
Loop
rs.Close
Debug.Print oSchema!table_n ame
End If
oSchema.MoveNex t
Loop
eWorkBook.SaveA s App.Path & "\data\Report\1 .xls"
Screen.MousePoi nter = vbNormal
Exit Sub
End Sub[/code]
Thanks Werner
[code=vb]
Private Sub Command2_Click( )
DeleteFile App.Path & "\data\Report\1 .xls"
'first
Command2.Visibl e = False
If Not Len(Text9.Text) < 1 Then
Adodc1.Connecti onString = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source= " + App.Path + "\data\adodb1.m db"
Set DataGrid1.DataS ource = Adodc1
SorSor = False
Adodc1.Recordse t.Update
Text1.Enabled = 0: Text2.Enabled = 0: Text3.Enabled = 0
Text4.Enabled = 0: Text5.Enabled = 0: Text6.Enabled = 0
Text7.Enabled = 0
Toolbar1.Button s.Item(1).Capti on = "New"
Toolbar1.Button s.Item(4).Enabl ed = True
End If
Dim cn As New ADODB.Connectio n
Dim oSchema As ADODB.Recordset
Dim rs As New ADODB.Recordset
Dim intFldCnt As Integer
Dim I As Integer
Dim j As Integer
Dim sngColWid As Single
Screen.MousePoi nter = vbHourglass
strDBName = App.Path & "\" & "\data\adodb1.m db"
cn.ConnectionSt ring = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" & strDBName & ";Persist Security Info=False"
cn.Open (strDBName)
Set oSchema = cn.OpenSchema(a dSchemaTables)
Set Excel = New Excel.Applicati on
Set eWorkBook = Excel.Workbooks .Add
Do Until oSchema.EOF
If InStr(oSchema!t able_name, "MSys") = 0 Then
Set eWorkSheet = eWorkBook.Works heets.Add
If InStr(oSchema!t able_name, "/") <> 0 Then
eWorkSheet.Name = Replace(oSchema !table_name, "/", "-")
End If
rs.Open "select * from [" & oSchema!table_n ame & "]", cn
intFldCnt = rs.Fields.Count - 1
For I = 1 To intFldCnt
eWorkSheet.Cell s(1, I) = rs.Fields(I).Na me
If TextWidth(rs.Fi elds(I).Name) > sngColWid Then
sngColWid = TextWidth(rs.Fi elds(I).Name)
End If
Next I
eWorkSheet.Rang e("A1", "h1").Font. Bold = True
eWorkSheet.Rang e("h1", "h1").Font.Unde rline = True
eWorkSheet.Rang e("a1:e1500").H orizontalAlignm ent = "3"
eWorkSheet.Rang e("g1:g1500").H orizontalAlignm ent = "3"
eWorkSheet.Rang e("f1:f1500").H orizontalAlignm ent = "2"
eWorkSheet.Cell s(1, 1) = "Entry"
eWorkSheet.Cell s(1, 2) = "Project"
eWorkSheet.Cell s(1, 3) = "VAT"
eWorkSheet.Cell s(1, 4) = "Cost Code"
eWorkSheet.Cell s(1, 5) = "Date / Ref"
eWorkSheet.Cell s(1, 6) = "Descriptio n"
eWorkSheet.Cell s(1, 7) = "Amount"
eWorkSheet.Cell s(1, 8) = Label5.Caption
eWorkSheet.Colu mns(1).ColumnWi dth = "7"
eWorkSheet.Colu mns(2).ColumnWi dth = "10"
eWorkSheet.Colu mns(3).ColumnWi dth = "10"
eWorkSheet.Colu mns(4).ColumnWi dth = "10"
eWorkSheet.Colu mns(5).ColumnWi dth = "15"
eWorkSheet.Colu mns(6).ColumnWi dth = "50"
eWorkSheet.Colu mns(7).ColumnWi dth = "15"
eWorkSheet.Colu mns(8).ColumnWi dth = "12"
j = 2
Do Until rs.EOF
For I = 1 To intFldCnt
eWorkSheet.Cell s(j, I) = rs.Fields(I).Va lue
Next I
j = j + 1
rs.MoveNext
Loop
rs.Close
Debug.Print oSchema!table_n ame
End If
oSchema.MoveNex t
Loop
eWorkBook.SaveA s App.Path & "\data\Report\1 .xls"
Screen.MousePoi nter = vbNormal
Exit Sub
End Sub[/code]
Comment