strange error message

  • Thread starter Thread starter Song Su
  • Start date Start date
S

Song Su

My code worked before, but now has strange message. The error message is:
'ActiveX component can't create object'

My code is below:

Private Sub cmdExport_Click()
On Error GoTo cmdExport_Err
Dim answer As Integer
Dim fs, d
answer = MsgBox("Insert a disk in A: Ready to export?", vbOKCancel +
vbDefaultButton2)

If answer = 1 Then
' Check to see if A: is ready
Set fs = CreateObject("Scripting.FileSystemObject")
Set d = fs.GetDrive("A:")
If d.IsReady Then
DoCmd.TransferDatabase acExport, "dBase IV", "a:\", acQuery,
"ActiveQuery", "Active.dbf"
MsgBox "Export completed"
Else
MsgBox "A: drive is empty. Export canceled"
End If
Else
MsgBox "Export canceled"
End If
cmdExport_Exit:
Exit Sub

cmdExport_Err:
MsgBox Error$
Resume cmdExport_Exit

End Sub
 
hi Song,

Song said:
My code worked before, but now has strange message. The error message is:
'ActiveX component can't create object'
Comment out the error handler. At which line does the code execution stops?
Private Sub cmdExport_Click()
On Error GoTo cmdExport_Err
Dim answer As Integer
Dim fs, d
Better declare fs and d as Object, not as Variant.
answer = MsgBox("Insert a disk in A: Ready to export?", vbOKCancel +
vbDefaultButton2)

If answer = 1 Then
' Check to see if A: is ready
Set fs = CreateObject("Scripting.FileSystemObject")
If it stops here, then the Scripting library is not properly installed.


mfG
--> stefan <--
 
Thanks for quick reply. It does stop at createobject. how to reinstall
scripting library?
 
hi Song,

Song said:
Thanks for quick reply. It does stop at createobject. how to reinstall
scripting library?
Reinstall or repair one of the following products:

- Windows Script Host
- VBScript
- Internet Explorer
- Microsoft Office


mfG
--> stefan <--
 
Back
Top