requery command button

M

Mark

Hi,

I have a form, "formRegistrationApproval", which is based
off of a query that fills the form with class registration
information from a table, "tableClassRegistration". The
query returns records that have not been approved or
denied yet. On my form, I can approve/deny a record then
press a command button that requeries and returns any
remainding records that have not been approved/denied.
After I approve/deny the last record the query returns no
more records (which is running correctly), but the form is
now blank. I would like the form to display a message box
stating that there are no more records to approve/deny at
this time as with the following code/message:

MsgBox "There are no additional approvals to be made at
this time.", vbCritical, "End of Registration Approvals"

How can I go about getting my form to display this
message when no more records are returned by my query and
then when the user presses "ok" the form closes???

Thanks for helping me out with this!!!!!!!!!!!!!!!!!!


Below is the click command button properties of the "save
record/requery" that I have on my form that saves the
record and then requeries the records from the table
(returning the records that have not been approved/denied
yet):

Private Sub SaveRecordRequery_Click()
On Error GoTo Err_SaveRecordRequery_Click

If IsNull(Me.ClassApproved) Then
MsgBox "You must select Yes or No before saving
registration approval.", vbInformation, "Please Select Yes
or No"
End If

DoCmd.DoMenuItem acFormBar, acRecordsMenu,
acSaveRecord, , acMenuVer70
Forms.formRegistrationApproval.Requery

Exit_SaveRecordRequery_Click:
Exit Sub

Err_SaveRecordRequery_Click:
MsgBox Err.Description
Resume Exit_SaveRecordRequery_Click

End Sub
 
A

Allen Browne

After the Requery:
If Me.RecordsetClone.RecordCount = 0 Then
MsgBox "None left!"
End If
 
M

Mark

Hey Allen,

Thanks a bunch!!!! It works great!!! What took me all
afternoon to look at and some this morning... took you all
of seconds to answer. I was having a problem getting the
record count when = 0 to display the message. Moreover, I
was trying to figure out how the query was identifying
the "new record" or "blank record" (when I ran the query
the first column, which is the dark grey shaded area where
the record selector is on, the "*" sign was where I was
getting hung up on. So, thanks for showing me how to
identify a new record or rather a record equalling zero.

This site has been a tremdous help... thanks to you!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top