Help with a DB beginer 
Author Message
 Help with a DB beginer

What is wroing with this this is straight out of (Profesional VB6 databases
by Wrox)
im tring it out to do the problems and it says compile error Sub or function
not defined
TIA

Private Sub cmdAction_Click(Index As Integer)

 On Error GoTo qoActionErr

With Adodc1

Select Case Index

Case 0 'Add
    If cmdAction(0).Caption = "&Add" Then
        varBookMark = .Recordset.Bookmark
        .Recordset.AddNew
        txtField(0).SetFocus
        cmdAction(0).Caption = "&Cancel"
        SetVisible False
Else
.Recordset.CancelUpdate
If varBookMark > 0 Then
.Recordset.Bookmark = varBookMark
 Else
.Recordset.MoveFirst
End If
cmdAction(Index).Caption "&Add"
SetVisible True
End If
Case 1   'Delete
If Recordset.EditMode = False Then
.Recordset.Delete
.Recordset.MoveNext
If Recordset.EOF Then
Recordset.MoveLast
Else
MsgBox "Must update or refresh record before deleting!"
End If
Case 2 'Find
frmFind.Show
Case 3 'Update
.Recordset.Update
varBookMark = Recordset.Bookmark
.Recordset.Requery
If varBookMark > 0 Then
.Recordset.Bookmark = varBookMark
Else
.Recordset.MoveLast
End If
cmdAction(0).Caption -"&Add"
SetVisible True
Case 4 'Refresh
varBookMark = .Recordset.Bookmark
.Refresh
If varBookMark > 0 Then
.Recordset.Bookmark = varBookMark
Else
.Recordset.MoveLast
End If
End Select
End With
Exit Sub

goActionErr:
MsgBox Err.Desdription
End Sub



Tue, 20 May 2003 03:00:00 GMT  
 Help with a DB beginer

If you pasted the code into the message and they're not just typos these should
be:

cmdAction(0).Caption -"&Add"   ' should be = "&Add"

cmdAction(Index).Caption "&Add"  'should be = "&Add"

Albert LaPlante


Quote:

>What is wroing with this this is straight out of (Profesional VB6 databases
>by Wrox)
>im tring it out to do the problems and it says compile error Sub or function
>not defined
>TIA

>Private Sub cmdAction_Click(Index As Integer)

> On Error GoTo qoActionErr

>With Adodc1

>Select Case Index

>Case 0 'Add
>    If cmdAction(0).Caption = "&Add" Then
>        varBookMark = .Recordset.Bookmark
>        .Recordset.AddNew
>        txtField(0).SetFocus
>        cmdAction(0).Caption = "&Cancel"
>        SetVisible False
>Else
>.Recordset.CancelUpdate
>If varBookMark > 0 Then
>.Recordset.Bookmark = varBookMark
> Else
>.Recordset.MoveFirst
>End If
>cmdAction(Index).Caption "&Add"
>SetVisible True
>End If
>Case 1   'Delete
>If Recordset.EditMode = False Then
>.Recordset.Delete
>.Recordset.MoveNext
>If Recordset.EOF Then
>Recordset.MoveLast
>Else
>MsgBox "Must update or refresh record before deleting!"
>End If
>Case 2 'Find
>frmFind.Show
>Case 3 'Update
>.Recordset.Update
>varBookMark = Recordset.Bookmark
>.Recordset.Requery
>If varBookMark > 0 Then
>.Recordset.Bookmark = varBookMark
>Else
>.Recordset.MoveLast
>End If
>cmdAction(0).Caption -"&Add"
>SetVisible True
>Case 4 'Refresh
>varBookMark = .Recordset.Bookmark
>.Refresh
>If varBookMark > 0 Then
>.Recordset.Bookmark = varBookMark
>Else
>.Recordset.MoveLast
>End If
>End Select
>End With
>Exit Sub

>goActionErr:
>MsgBox Err.Desdription
>End Sub



Wed, 21 May 2003 09:41:36 GMT  
 Help with a DB beginer
you need to declare the variable SetVisible as a boolean
like...   Dim SetVisible As Boolean.
then to make true or false, do this....  SetVisible = True


Quote:
> What is wroing with this this is straight out of (Profesional VB6
databases
> by Wrox)
> im tring it out to do the problems and it says compile error Sub or
function
> not defined
> TIA

> Private Sub cmdAction_Click(Index As Integer)

>  On Error GoTo qoActionErr

> With Adodc1

> Select Case Index

> Case 0 'Add
>     If cmdAction(0).Caption = "&Add" Then
>         varBookMark = .Recordset.Bookmark
>         .Recordset.AddNew
>         txtField(0).SetFocus
>         cmdAction(0).Caption = "&Cancel"
>         SetVisible False
> Else
> .Recordset.CancelUpdate
> If varBookMark > 0 Then
> .Recordset.Bookmark = varBookMark
>  Else
> .Recordset.MoveFirst
> End If
> cmdAction(Index).Caption "&Add"
> SetVisible True
> End If
> Case 1   'Delete
> If Recordset.EditMode = False Then
> .Recordset.Delete
> .Recordset.MoveNext
> If Recordset.EOF Then
> Recordset.MoveLast
> Else
> MsgBox "Must update or refresh record before deleting!"
> End If
> Case 2 'Find
> frmFind.Show
> Case 3 'Update
> .Recordset.Update
> varBookMark = Recordset.Bookmark
> .Recordset.Requery
> If varBookMark > 0 Then
> .Recordset.Bookmark = varBookMark
> Else
> .Recordset.MoveLast
> End If
> cmdAction(0).Caption -"&Add"
> SetVisible True
> Case 4 'Refresh
> varBookMark = .Recordset.Bookmark
> .Refresh
> If varBookMark > 0 Then
> .Recordset.Bookmark = varBookMark
> Else
> .Recordset.MoveLast
> End If
> End Select
> End With
> Exit Sub

> goActionErr:
> MsgBox Err.Desdription
> End Sub



Wed, 21 May 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Beginer NEED HELP.

2. beginer in q basic-help

3. BEGINER NEED HELP!!

4. BEGINER NEEDS HELP PLEASE...

5. Help for a beginer

6. Beginer help with timers please

7. Beginer NEED HELP

8. beginer to crescent internet tool pack, need help

9. beginer need HELP

10. HELP BEGINER

11. SQL + VB Beginer need help

12. Beginer needs help openig new files

 

 
Powered by phpBB® Forum Software