AddNew Method not working for me anymore. 
Author Message
 AddNew Method not working for me anymore.

This problem has just recently reared its head for me, and I can't seem to
figure out why.  I am writing a small application using an MS Access
database for my data storage, and VB for my front end.  I am relying
primarily on data bound controls, but from time to time, I need to change
the data using code, as I am sure we all do.

I have a new button on my  form that allows the user to add a new record to
a recordset, and this new button was working fine, but recently, perhaps
because of some new code I have added, the new button creates the new
record, but instead of editing the new record, edits the old one that I was
on before the new record was created.

I know it is creating some sort of blank record because it adds one to the
key id field, which I have displaying on the form, but when I try to change
records or update the recordset, it deletes the new record and makes the
changes I have mad to the record that the pointer was on prior to the addnew
method being called.

I don't know if what I just said makes sense or not, but if anyone can help
me or has experienced this problem before, I would appreciate the help.

Once again, the add new method was working just a short time ago.

Justin
PS  Please respond to my e-mail address as well as the newsgroup.
Sometimes, I cannot seem to find my message.

==========================================
This message was sent from the desk of:

Justin E. Jones
Integrity Administrators, Inc.


916-921-3388

January 1, 2000 is not the beginning of
the next millennium.
==========================================



Fri, 23 Mar 2001 03:00:00 GMT  
 AddNew Method not working for me anymore.
It would help if you gave code examples, paste the code
under the new button.

etta

Quote:

>This problem has just recently reared its head for me, and I can't seem to
>figure out why.  I am writing a small application using an MS Access
>database for my data storage, and VB for my front end.  I am relying
>primarily on data bound controls, but from time to time, I need to change
>the data using code, as I am sure we all do.

>I have a new button on my  form that allows the user to add a new record to
>a recordset, and this new button was working fine, but recently, perhaps
>because of some new code I have added, the new button creates the new
>record, but instead of editing the new record, edits the old one that I was
>on before the new record was created.

>I know it is creating some sort of blank record because it adds one to the
>key id field, which I have displaying on the form, but when I try to change
>records or update the recordset, it deletes the new record and makes the
>changes I have mad to the record that the pointer was on prior to the
addnew
>method being called.

>I don't know if what I just said makes sense or not, but if anyone can help
>me or has experienced this problem before, I would appreciate the help.

>Once again, the add new method was working just a short time ago.

>Justin
>PS  Please respond to my e-mail address as well as the newsgroup.
>Sometimes, I cannot seem to find my message.

>==========================================
>This message was sent from the desk of:

>Justin E. Jones
>Integrity Administrators, Inc.


>916-921-3388

>January 1, 2000 is not the beginning of
>the next millennium.
>==========================================



Sat, 24 Mar 2001 03:00:00 GMT  
 AddNew Method not working for me anymore.
'In response for the request for some code, I have included the following
'This is the code for the new button

Private Sub NewBtn_Click()
    DS_Grouptbl.Recordset.AddNew
    NameBox.SetFocus
End Sub

'This is the coed for the validate event

Private Sub DS_Grouptbl_Validate(Action As Integer, Save As Integer)
    Dim Zip$
    Dim MsgResult As Long
    'Thinking this was the problem, I tried commenting out the
    'following line, but it didn't help'
    DS_Grouptbl.UpdateRecord
    Zip$ = Left(ZipBox.Text, 3)
    If DS_Grouptbl.Recordset.Fields("NOTELIG").Value = True Then
        MsgResult = MsgBox("This group is not eligible for coverage.", _
            vbOKOnly, "DentAssure Message")
    End If
    If Len(ZipBox.Text) < 3 Or InStr(1, Zip$, "-", vbTextCompare) Then
        MsgResult = MsgBox("A valid Zip Code must be entered to make a
quote.", _
            vbOKOnly, "Format Error")
    End If
    If CTypeBox.Text = "<Undefined>" Then
        MsgResult = MsgBox("A valid SIC Code must be entered to make a
quote.", _
            vbOKOnly, "Format Error")
    End If
    If StateCombo.Text = "" Then
        MsgResult = MsgBox("A state must be chosen to make a quotation.", _
            vbOKOnly, "Format Error")
    End If
    If Label12.Caption = "You must call Integrity Administrators for a " & _
             "referal on this group." Then
        MsgResult = MsgBox("You must call Integrity Administrators for a " &
_
             "referal on this group.", vbOKOnly, "DentAssure Message")
    End If

End Sub

'This is the code for the form's load event

Private Sub Form_Load()
    SearchBox.Text = ""
    FirstGroupSearch = True
    DS_Grouptbl.DatabaseName = AppDir & "\dnt1.mdb"
    DS_SEARCHTBL.DatabaseName = AppDir & "\dnt1.mdb"
    DS_StateTbl.DatabaseName = AppDir & "\dnt1.mdb"
    DS_ZipTbl.DatabaseName = AppDir & "\dnt1.mdb"
    DSSICDESCQRY.DatabaseName = AppDir & "\dnt1.mdb"
End Sub

'This is the code for the form's activate event

Private Sub Form_Activate()
    CallingFormSave = CallingForm
    If CallingForm = "quotefrm1" Or CallingForm = "quoteform2" Then
        QuoteBtn.Enabled = False
    Else
        QuoteBtn.Enabled = True
    End If
    If CallingForm = "quotefrm1" Then
        NewBtn_Click
    End If
    If Label12.Caption = "" Then
        TotalBox_Change
    End If
End Sub

'These are the properties for DS_Grouptbl
'
'   Begin VB.Data DS_Grouptbl
'      Caption         =   "Groups"
'      Connect         =   ";pwd=helpme;"
'      DatabaseName    =   "F:\windev\vb\src\dentassure\dnt1.mdb"
'      DefaultCursorType=   0  'DefaultCursor
'      DefaultType     =   2  'UseODBC
'      Exclusive       =   0   'False
'      Height          =   375
'      Left            =   1800
'      Options         =   0
'      ReadOnly        =   0   'False
'      RecordsetType   =   1  'Dynaset
'      RecordSource    =   "GROUPQRY"
'      Top             =   5160
'      Width           =   2895
'   End

==========================================
This message was sent from the desk of:

Justin E. Jones
Integrity Administrators, Inc.


916-921-3388

January 1, 2000 is not the beginning of
the next millennium.
==========================================

Quote:

>This problem has just recently reared its head for me, and I can't seem to
>figure out why.  I am writing a small application using an MS Access
>database for my data storage, and VB for my front end.  I am relying
>primarily on data bound controls, but from time to time, I need to change
>the data using code, as I am sure we all do.

>I have a new button on my  form that allows the user to add a new record to
>a recordset, and this new button was working fine, but recently, perhaps
>because of some new code I have added, the new button creates the new
>record, but instead of editing the new record, edits the old one that I was
>on before the new record was created.

>I know it is creating some sort of blank record because it adds one to the
>key id field, which I have displaying on the form, but when I try to change
>records or update the recordset, it deletes the new record and makes the
>changes I have mad to the record that the pointer was on prior to the
addnew
>method being called.

>I don't know if what I just said makes sense or not, but if anyone can help
>me or has experienced this problem before, I would appreciate the help.

>Once again, the add new method was working just a short time ago.

>Justin
>PS  Please respond to my e-mail address as well as the newsgroup.
>Sometimes, I cannot seem to find my message.

>==========================================
>This message was sent from the desk of:

>Justin E. Jones
>Integrity Administrators, Inc.


>916-921-3388

>January 1, 2000 is not the beginning of
>the next millennium.
>==========================================



Sat, 24 Mar 2001 03:00:00 GMT  
 AddNew Method not working for me anymore.
This is really effective :(

==========================================
This message was sent from the desk of:

Justin E. Jones
Integrity Administrators, Inc.


916-921-3388

January 1, 2000 is not the beginning of
the next millennium.
==========================================



Sun, 25 Mar 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. AddNew not working anymore???

2. AddNew method does not work

3. .addnew method ADO does not work pls help

4. AddNew/REquery method of ADO Recordset not Working?

5. Addnew and update method in ADOCE not working ?

6. data1.recordset.addnew doesnt work anymore

7. Urgent! PUBLIC does not work anymore

8. VB5CCE can not work anymore :-(

9. IUSR account not working anymore

10. MSINET vs IE 4 (FTP not working anymore)

11. Crystal on ASP, not working anymore !

12. Herlp: LIKE in SQL doe not work anymore

 

 
Powered by phpBB® Forum Software