
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.
>==========================================