Please HELP. I am very frustrated ! 
Author Message
 Please HELP. I am very frustrated !

I have written a small application using an Access8.0 database. I am
using DAO with no Data control or bound controls. The problem I am
having is if I edit a record from my form and save the changes then edit
the same record and save the changes I get a runtime error (3021) "No
record found".

I have posted this problem here and to the VB General Discussion Group
before and have gotten no response. I need to figure out this problem. I
have tried to research it through several books, I tried to find
information about the runtime error on Microsofts' site and I must be
doing something wrong there because I couldn't find the info.

Are people not responding because I am unknowingly doing something (or
not) that makes me a jerk ? I'm sure that I am not the only person who
has run across this problem so I am frustrated that no one is helping
me.

If anyone is reading this, if I am being stupid I really don't mean to
be. Also, thank you kindly in advance for any help you could provide.

Here is my code for the EDIT and SAVE buttons on the form:

Private Sub cmdEDIT_Click()

    For Each CTL In Me.Controls
        If TypeOf CTL Is TextBox Then
            CTL.BackColor = vbYellow
            CTL.Locked = False
        End If
    Next

    Me.lblDistName.BackColor = vbYellow
    Me.lblDistName.Caption = "EDIT " & Me.txtName.Text
    Me.cmdADD.Enabled = False
    Me.cmdDELETE.Enabled = False
    Me.cmdEDIT.Enabled = False
    'Me.cmdFIND.Enabled = False
    Me.cmdCANCEL.Enabled = True
    Me.cmdSAVE.Enabled = True

End Sub

Private Sub cmdSave_Click()

Dim tmpMsg

'*** Don't allow Save if no Distributor Name
    If Me.txtName = "" Then
        MsgBox "You must fill in a Distributor Name", , "PROBLEM !"
        Me.txtName.SetFocus
        Exit Sub
    End If

'*** If User pressed Add New, save new record. If not, save edited
record
    If Me.lblDistName.Caption = "ADD NEW DISTRIBUTOR" Then
        RSDist.AddNew
        Call FillRec
        RSDist.Update
        RSDist.Bookmark = RSDist.LastModified
    Else
        tmpMsg = MsgBox("Are you sure you want to save changes to this
record ?",
                                        vbDefaultButton2 + vbYesNo)
        If tmpMsg = vbYes Then
            RSDist.Edit
            Call FillRec
            RSDist.Update
            RSDist.Bookmark = RSDist.LastModified
        End If
    End If

'*** Format controls back to normal so user knows Save is complete.
    For Each CTL In Me.Controls
        If TypeOf CTL Is TextBox Then
            CTL.BackColor = vbWhite
            CTL.Locked = True
        End If
    Next
    Me.lblDistName.BackColor = RGB(166, 202, 240)
    Me.lblDistName.Caption = "DISTRIBUTOR"
    Me.cmdADD.Enabled = True
    Me.cmdDELETE.Enabled = True
    Me.cmdEDIT.Enabled = True
    'Me.cmdFIND.Enabled = True
    Me.cmdCANCEL.Enabled = False
    Me.cmdSAVE.Enabled = False

'*** Refresh the screeen with the new or modified record
    Call FillScreen

'*** Refresh the list in the DistName combo box
    Call FillCombo

End Sub



Sat, 07 Oct 2000 03:00:00 GMT
 Please HELP. I am very frustrated !

I see nothing wrong with your code example in the aspects of the edit
update and addnew methods... So the thought comes to mind
ARE you using the SP3 upgrade from microsoft....?



Quote:
>>I have written a small application using an Access8.0 database. I am
>>using DAO with no Data control or bound controls. The problem I am
>>having is if I edit a record from my form and save the changes then edit
>>the same record and save the changes I get a runtime error (3021) "No
>>record found".

>>I have posted this problem here and to the VB General Discussion Group
>>before and have gotten no response. I need to figure out this problem. I
>>have tried to research it through several books, I tried to find
>>information about the runtime error on Microsofts' site and I must be
>>doing something wrong there because I couldn't find the info.

>>Are people not responding because I am unknowingly doing something (or
>>not) that makes me a jerk ? I'm sure that I am not the only person who
>>has run across this problem so I am frustrated that no one is helping
>>me.

>>If anyone is reading this, if I am being stupid I really don't mean to
>>be. Also, thank you kindly in advance for any help you could provide.

                            TRoN~!
                            CompuTec Data Systems


Sun, 08 Oct 2000 03:00:00 GMT
 Please HELP. I am very frustrated !

Martin,

Saw your post before and didn't respond because I didn't see anything
obviously wrong with your code.  I still don't.  (So if you're being stupid,
at least you know you're not alone! <g>)  And, that being the case, all I
can suggest is that you step through the code and find out where you are
after the first edit, as opposed to the AddNew, and then where you are when
you enter it the second time.

I did once have a problem using VB4 against an Acces 95 db where cursor was
on the correct record before the Edit, but somewhere internal to VB it was
going to eof _during_ the Edit.  Not my code, but somewhere between the call
to rs.Edit and it's return.  Very ugly.  I wound up having to create a
duplicate recordset just for the edit.

HTH

    - Rebecca.

Quote:

>I have written a small application using an Access8.0 database. I am
>using DAO with no Data control or bound controls. The problem I am
>having is if I edit a record from my form and save the changes then edit
>the same record and save the changes I get a runtime error (3021) "No
>record found".

>I have posted this problem here and to the VB General Discussion Group
>before and have gotten no response. I need to figure out this problem. I
>have tried to research it through several books, I tried to find
>information about the runtime error on Microsofts' site and I must be
>doing something wrong there because I couldn't find the info.

>Are people not responding because I am unknowingly doing something (or
>not) that makes me a jerk ? I'm sure that I am not the only person who
>has run across this problem so I am frustrated that no one is helping
>me.

>If anyone is reading this, if I am being stupid I really don't mean to
>be. Also, thank you kindly in advance for any help you could provide.

>Here is my code for the EDIT and SAVE buttons on the form:

>Private Sub cmdEDIT_Click()

>    For Each CTL In Me.Controls
>        If TypeOf CTL Is TextBox Then
>            CTL.BackColor = vbYellow
>            CTL.Locked = False
>        End If
>    Next

>    Me.lblDistName.BackColor = vbYellow
>    Me.lblDistName.Caption = "EDIT " & Me.txtName.Text
>    Me.cmdADD.Enabled = False
>    Me.cmdDELETE.Enabled = False
>    Me.cmdEDIT.Enabled = False
>    'Me.cmdFIND.Enabled = False
>    Me.cmdCANCEL.Enabled = True
>    Me.cmdSAVE.Enabled = True

>End Sub

>Private Sub cmdSave_Click()

>Dim tmpMsg

>'*** Don't allow Save if no Distributor Name
>    If Me.txtName = "" Then
>        MsgBox "You must fill in a Distributor Name", , "PROBLEM !"
>        Me.txtName.SetFocus
>        Exit Sub
>    End If

>'*** If User pressed Add New, save new record. If not, save edited
>record
>    If Me.lblDistName.Caption = "ADD NEW DISTRIBUTOR" Then
>        RSDist.AddNew
>        Call FillRec
>        RSDist.Update
>        RSDist.Bookmark = RSDist.LastModified
>    Else
>        tmpMsg = MsgBox("Are you sure you want to save changes to this
>record ?",
>                                        vbDefaultButton2 + vbYesNo)
>        If tmpMsg = vbYes Then
>            RSDist.Edit
>            Call FillRec
>            RSDist.Update
>            RSDist.Bookmark = RSDist.LastModified
>        End If
>    End If

>'*** Format controls back to normal so user knows Save is complete.
>    For Each CTL In Me.Controls
>        If TypeOf CTL Is TextBox Then
>            CTL.BackColor = vbWhite
>            CTL.Locked = True
>        End If
>    Next
>    Me.lblDistName.BackColor = RGB(166, 202, 240)
>    Me.lblDistName.Caption = "DISTRIBUTOR"
>    Me.cmdADD.Enabled = True
>    Me.cmdDELETE.Enabled = True
>    Me.cmdEDIT.Enabled = True
>    'Me.cmdFIND.Enabled = True
>    Me.cmdCANCEL.Enabled = False
>    Me.cmdSAVE.Enabled = False

>'*** Refresh the screeen with the new or modified record
>    Call FillScreen

>'*** Refresh the list in the DistName combo box
>    Call FillCombo

>End Sub



Sun, 08 Oct 2000 03:00:00 GMT
 Please HELP. I am very frustrated !

Do you use RSDist to fill the combo?

--
Cludio Avolio Rodrigues
IBM Global Services
Systems Specialist

http://www.c-avolio.com/vb

Quote:

>Martin,

>Saw your post before and didn't respond because I didn't see anything
>obviously wrong with your code.  I still don't.  (So if you're being
stupid,
>at least you know you're not alone! <g>)  And, that being the case, all I
>can suggest is that you step through the code and find out where you are
>after the first edit, as opposed to the AddNew, and then where you are when
>you enter it the second time.

>I did once have a problem using VB4 against an Acces 95 db where cursor was
>on the correct record before the Edit, but somewhere internal to VB it was
>going to eof _during_ the Edit.  Not my code, but somewhere between the
call
>to rs.Edit and it's return.  Very ugly.  I wound up having to create a
>duplicate recordset just for the edit.

>HTH

>    - Rebecca.


>>I have written a small application using an Access8.0 database. I am
>>using DAO with no Data control or bound controls. The problem I am
>>having is if I edit a record from my form and save the changes then edit
>>the same record and save the changes I get a runtime error (3021) "No
>>record found".

>>I have posted this problem here and to the VB General Discussion Group
>>before and have gotten no response. I need to figure out this problem. I
>>have tried to research it through several books, I tried to find
>>information about the runtime error on Microsofts' site and I must be
>>doing something wrong there because I couldn't find the info.

>>Are people not responding because I am unknowingly doing something (or
>>not) that makes me a jerk ? I'm sure that I am not the only person who
>>has run across this problem so I am frustrated that no one is helping
>>me.

>>If anyone is reading this, if I am being stupid I really don't mean to
>>be. Also, thank you kindly in advance for any help you could provide.

>>Here is my code for the EDIT and SAVE buttons on the form:

>>Private Sub cmdEDIT_Click()

>>    For Each CTL In Me.Controls
>>        If TypeOf CTL Is TextBox Then
>>            CTL.BackColor = vbYellow
>>            CTL.Locked = False
>>        End If
>>    Next

>>    Me.lblDistName.BackColor = vbYellow
>>    Me.lblDistName.Caption = "EDIT " & Me.txtName.Text
>>    Me.cmdADD.Enabled = False
>>    Me.cmdDELETE.Enabled = False
>>    Me.cmdEDIT.Enabled = False
>>    'Me.cmdFIND.Enabled = False
>>    Me.cmdCANCEL.Enabled = True
>>    Me.cmdSAVE.Enabled = True

>>End Sub

>>Private Sub cmdSave_Click()

>>Dim tmpMsg

>>'*** Don't allow Save if no Distributor Name
>>    If Me.txtName = "" Then
>>        MsgBox "You must fill in a Distributor Name", , "PROBLEM !"
>>        Me.txtName.SetFocus
>>        Exit Sub
>>    End If

>>'*** If User pressed Add New, save new record. If not, save edited
>>record
>>    If Me.lblDistName.Caption = "ADD NEW DISTRIBUTOR" Then
>>        RSDist.AddNew
>>        Call FillRec
>>        RSDist.Update
>>        RSDist.Bookmark = RSDist.LastModified
>>    Else
>>        tmpMsg = MsgBox("Are you sure you want to save changes to this
>>record ?",
>>                                        vbDefaultButton2 + vbYesNo)
>>        If tmpMsg = vbYes Then
>>            RSDist.Edit
>>            Call FillRec
>>            RSDist.Update
>>            RSDist.Bookmark = RSDist.LastModified
>>        End If
>>    End If

>>'*** Format controls back to normal so user knows Save is complete.
>>    For Each CTL In Me.Controls
>>        If TypeOf CTL Is TextBox Then
>>            CTL.BackColor = vbWhite
>>            CTL.Locked = True
>>        End If
>>    Next
>>    Me.lblDistName.BackColor = RGB(166, 202, 240)
>>    Me.lblDistName.Caption = "DISTRIBUTOR"
>>    Me.cmdADD.Enabled = True
>>    Me.cmdDELETE.Enabled = True
>>    Me.cmdEDIT.Enabled = True
>>    'Me.cmdFIND.Enabled = True
>>    Me.cmdCANCEL.Enabled = False
>>    Me.cmdSAVE.Enabled = False

>>'*** Refresh the screeen with the new or modified record
>>    Call FillScreen

>>'*** Refresh the list in the DistName combo box
>>    Call FillCombo

>>End Sub



Sun, 08 Oct 2000 03:00:00 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. Need Help Am Frustrated

2. Tired...Frustrated..Confused...Please Help

3. REALLY FRUSTRATED. PLEASE HELP

4. Hrmm, dont know if this is right but it sure has me frustrated, Help Please

5. Please Help!! I am Stuck

6. HELP PLEASE - what table am i quering???

7. Help Me please, I am a newbie

8. i am hopeless, please help!

9. Btrieve sucks and I am stupid please Help.

10. I am getting an error Please help if you can

11. Am in SQL Hell please help

12. Please Help - I am about to weep !!!


 
Powered by phpBB® Forum Software