Penn 227
penn227 at yahoo.com
Wed May 4 11:44:32 CDT 2005
ACC03-WinXP Pro
I'm at a loss with this problem and hope someone can
help.
I have a form in a 'members' database that allows
entry of people (members,
prospective members, guests, etc.) who have RSVP'd to
an upcoming meeting.
The Meeting info comes from tblMeetings (date,
location, time, etc.) and the
person info comes from tblPeople.
When a new record in frmRSVP is created, I would like
to fill in some of the
fields in the new record (those that are starred
below).
The form consists of the following controls (not
counting the command
buttons):
** ComboBox: MeetingID
** Text Box: MeetingDate
** Text Box: RSVPDue
Option Group: ogShowRecords
Option Button: optAll
Option Button: optFuture
Option Button: optPrevious
Combo Box: PersonID
Text Box: RSVPDate
Text Box: Status
Text Box: txtEmailAddress
Text Box: Note
Check Box: ReceiptConfSent
The Form_Current sub looks like this:
Private Sub Form_Current()
Dim intNewRec As Integer
Dim rsc As Recordset
On Error GoTo Err_Form_Current
intNewRec = Me.NewRecord
If intNewRec Then
Set rsc = Me.RecordsetClone
Me.cboMeetingID = rsc!MeetingID
Me.MeetingDate = DLookup("MeetingDate",
"tblMeetings", "MeetingID="
& rsc!MeetingID)
Me.RSVPDue = DLookup("RSVPDue", "tblMeetings",
"MeetingID=" &
rsc!MeetingID)
Set rsc = Nothing
rsc.Clone
If (Now() > Me.RSVPDue) Then
Me.Late = True
End If
End If
Me.PersonID.SetFocus
Exit_Form_Current:
Exit Sub
Err_Form_Current:
ErrorHandler...
Resume Exit_Form_Current
End Sub
This works fine as long as there is actually someone
selected in the
PersonID control. However, if it is blank, I get an
error "The Microsoft
Jet database engine can't find a record in the table
"tblPeople" with key
matching field(s) 'PersonID'. and I am thrown into an
endless loop trying to
get out of that record with the empty PeopleID
control.
Any help appreciated.
Penn
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com