Re: rs.AddNew or DBEngine(0)(0).Execute revisited

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Thu, 24 Apr 2008 09:07:40 -0700 (PDT), "pietlinden@xxxxxxxxxxx"
<pietlinden@xxxxxxxxxxx> wrote:

My form is based on the "Enrollment" table. and then that table has
child tables.
I can check for the existence of records in Student and Course just
fine and create enrollment records using .Execute if no arguments are
left blank. I was thinking I needed that because I wanted to know if
the insert succeeded by getting the .RecordsAffected property of the
Execute (?) command.

I wouldn't be inserting records using an append query at all! Why not simply
bind the form to the enrollment table (so any data entered will go right into
the table)? If you do so you can check the StudentID and CourseID controls in
the form's BeforeUpdate event, and cancel the update with a warning message if
either is null.

Private Sub Form_BeforeUpdate(Cancel as Integer)
Dim iAns As Integer
If IsNull(Me!cboStudent) Then
iAns = MsgBox("Please select a student or choose Cancel to start over", _
vbOKCancel)
Cancel = True ' cancel this addition in any case
If iAns = vbCancel Then
Me.Undo ' erase the form completely if requested
End If
End If
<do the same for cboClass>
--

John W. Vinson [MVP]
.



Relevant Pages

  • Re: Typical College Program performance
    ... That strain can give rise to fingering errors. ... the best way to execute. ... It also can be difficult for a student to ... complexity of playing execution. ...
    (rec.music.classical.guitar)
  • Re: I want to Execute windows System restore on log out
    ... the System restore build into XP when a 'Student' logs out. ... execute this on exiting. ... Would I have to write my own lil program/script to ...
    (microsoft.public.windowsxp.general)
  • Re: Typical College Program performance
    ... but that is still no excuse. ... Playing before a video camera or any recording medium is extremely ... the best way to execute. ... it may not be the teachers fault that the student ...
    (rec.music.classical.guitar)
  • RE: File-search results in worksheet
    ... "hmm" wrote: ... "Gary''s Student" wrote: ... Dim s As String ... If .Execute()> 0 Then ...
    (microsoft.public.excel.worksheet.functions)