Using ADO in Access 2000
To use a Microsoft Access 2000 database and ADO you have
to add the correct references in your Visual Basic project.
To add the references to your Visual Basic project follow
the instruction's below.
Open a project.
From the Project menu, click References.
From the list, select Microsoft ActiveX Data Objects
2.1 Library.
From the list, select Microsoft ADO Ext. 2.1 for DDL
and Security.
From the list, select Microsoft Jet and Replication Objects
2.1 Library.
Click OK.
This should let you now use an Access 2000 database with
an ADODC control. However Data form Wizard will still face
problems!
Understanding Error Handlers
When you use On Error GoTo and an error occurs, VB enters
exception mode. The line you GoTo is supposed to be the
beginning of an error handler. If an error occurs within
an error handler, the program stops. What you need to do
is leave the error handler and resume normal execution.
Then you can use On Error to establish a new error handler
for the next error. You do this with the Resume statement.
See the help for details. In this case, you can use Resume
LineLabel to make the program continue execution at a specific
line.
Unfortunately, executing
Resume from outside an error handler generates an error.
Thus you cannot place the error handler in the flow of code
the way you have. You need to jump out to the error handler
and jump back with Resume.
Below is a subroutine
that demonstrates two error handler.
Private Sub Command1_Click()
Dim i As Integer
On Error GoTo Error1
i = 1 / 0 ' Divide by zero.
Error1Resume:
On Error GoTo Error2
i = 1000000 ' Too big--overflow.
Error2Resume:
MsgBox "Finishing."
' Do not fall through into the error handlers!
Exit Sub
Error1:
' Resume ends error handler mode.
MsgBox "First error handler."
Resume Error1Resume
Error2:
' Resume ends error handler mode.
MsgBox "Second error handler."
Resume Error2Resume
End Sub
Stop your modem from frequently disconnecting