MSGBOX In Query

  • Thread starter Thread starter James
  • Start date Start date
J

James

Hello I have the following code which I presume would make
an MSGBOX in a query and pop up the number of records in
that MSGBOX...

Would this be corrent and where would I put the code in
the query...

Many Thanks

James

MsgBox("The current Number of Discharged cases is( =Count
([Ref])")
 
James

There's no place "in a query" to code a message box. You'll probably need
to write a procedure that:
creates a recordset, based on the query
uses the .MoveLast method to "count" the recordset
uses the .RecordCount method to get the count
uses a MsgBox statement to display the count

If you explain a bit more why you want to do this, and what you are trying
to do, not how, the 'group readers could offer alternatives.

Good luck

Jeff Boyce
<Access MVP>
 
Ok sorry...

I am trying to get a query which gets certain information
from the data in a database and what is needed from the
database is a count of all the records which come up in
the query. This is to be done with a MSGBOX stating there
are 123 (or how ever many records) in this particular
query and then the details follow...

Does this help?

Also I would like to follow your instructions but I am a
little unsure about how to go about it how can I achive
what you are asking me to do?

Many Thanks

James
 
James

My suggestion was that you create a procedure. If you are unfamiliar with
writing code, either in modules or behind forms/reports, what you describe
wanting to accomplish may not be possible in the short term.

You've been very specific about the "how" -- perhaps if you described a bit
more of the "what" (as in "what are you trying to accomplish", without any
database terminology) the 'group readers could offer alternatives.

Good luck

Jeff Boyce
<Access MVP>
 
Ok,
What I need is a box which pops up and gives teh number
of records which are being shown so it will say something
about the total number of records in (number goes here)
then when the user clicks ok it goes to the query and
shows all the records and details for each record.

Does this help?

Many Thanks

James
 
James

That's kinda what I thought. Again, you'll need to do code to make that
exact version happen.

Let's consider another approach, though, since it sounds like you want to
inform the user how many records there are, on the way to displaying them
all...

If you had a form that displayed each/all records, and there was a number at
the bottom that said how many records there were, would that accomplish the
same things? (i.e., give the user a way to view the records/details, and to
know how many there are)

Good luck

Jeff Boyce
<Access MVP>
 
James

Build a form. Bind it to the table that has the records you want the user
to see. At the bottom of the form, the navigation bar shows something like
" 1 of nnn".

Good luck

Jeff Boyce
<Access MVP>
 
Thanks For that I appreciate all the help with this...

Sorry it took so long...

Many Thanks Again

James
 
Back
Top