i have highlighted where i get an error.. pls help. if u must know i got the source code online and modified it to suit my requirements.
Expand|Select|Wrap|Line Numbers
- Option Explicit
- Dim db As Database
- Dim rs As Recordset
- Private Sub Form_Load()
- On Error GoTo ErrHandler
- Set db = OpenDatabase(App.Path & "\sad.mdb")
- Set rs = db.OpenRecordset("supplier", dbOpenDynaset)
- Exit Sub
- ErrHandler:
- Dim ErrNum, ErrDesc, ErrSource
- ErrNum = Err.Number
- ErrDesc = Err.Description
- ErrSource = Err.Source
- MsgBox "Error# = " & ErrNum & vbCrLf & "Description = " & ErrDesc & vbCrLf & "Source = " & ErrSource, vbCritical + vbOKOnly, "Program Error!"
- Err.Clear
- Exit Sub
- End Sub
- Private Sub cmd_add_Click()
- On Error GoTo ErrHandler
- Dim SupplierID, Name, Address
- If txtID.Text = "" And txtName.Text = "" And _
- txtAddress.Text = "" Then
- MsgBox "You must enter information in for at least the supplier" _
- , vbOKOnly + vbCritical, "Data Required"
- ClearForm
- Exit Sub
- End If
- SupplierID = Encode(txtID.Text)
- Name = Encode(txtName.Text)
- Address = Encode(txtAddress.Text)
- With rs
- .AddNew
- !SupplierID = ID
- !Name = Name
- !Address = Address
- .Update
- End With
- ClearForm
- GetEntries
- Exit Sub
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- rs.Close
- db.Close
- End Sub