Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.visual.basic    |    MS Visual Basic discussions, NOT dot-net    |    10,840 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 9,434 of 10,840    |
|    Steve Z to All    |
|    Adding records to a DB    |
|    27 Apr 05 02:03:31    |
   
   From: stevez6996@hotmail.com   
      
   Some guidance por favor   
   I started this program with the Data Form Wizard (never again). I'm pretty   
   deep into it now, this piece of code keeps overwriting the first record in   
   the DB:   
   Private Sub cmdAdd_Click()   
    On Error GoTo AddErr   
    DatPrimaryRS.Recordset.MoveLast   
    DatPrimaryRS.Recordset.AddNew   
    DatPrimaryRS.Recordset.Fields("Caller").Value = txtCaller.Text   
    DatPrimaryRS.Recordset.Fields("Date").Value = txtDate.Text   
    DatPrimaryRS.Recordset.Fields("Time").Value = txtTime.Text   
    DatPrimaryRS.Recordset.Fields("Problem").Value = txtProblem.Text   
    DatPrimaryRS.Recordset.Update   
      
    Exit Sub   
    AddErr:   
    MsgBox Err.Description   
   End Sub   
      
   I've tried it a bunch of different ways, w/o the MoveLast, w/o the AddNew,   
   same result.   
   I've got this to work in other programs with the ADO Data Control, but this   
   DatPrimary stuff is so embedded in the form I'm concerned about replacing   
   it, plus when I add an Add button it craps out:   
   Private Sub cmdAdd_Click   
    AdoSurgery.Recordset.AddNew   
   End Sub   
   Private Sub cmdSave_Click()   
    AdoSurgery.Recordset.Fields("Surgeon") = txtSurgeon.Text   
    AdoSurgery.Recordset.Fields("Assistant Name") = txtAssistantName.Text   
    AdoSurgery.Recordset.Fields("Physician") = txtPhysician.Text   
    AdoSurgery.Recordset.Update   
   End Sub   
      
   gracias mi amigos.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca