Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Access 2010 Message Box

Posted on 2014-10-08
4
317 Views
Last Modified: 2014-10-08
I'm using the code below to drill down (link) to another form. I would like to pop up a message box if no records are found. Thanks

DoCmd.OpenForm "frm_Accounting_Events", , , "[Event Type]='" & Me.Event_Type & "'"
0
Comment
Question by:shieldsco
  • 2
4 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 40368277
add a dcount() to test if there are records  to show before opening the form

if dcount("*",<record source of the form>,"[Event Type]='" & Me.Event_Type & "'") =0 then
    msgbox "No records"
    exit sub
else
'open form


DoCmd.OpenForm "frm_Accounting_Events", , , "[Event Type]='" & Me.Event_Type & "'"

end if
0
 

Author Comment

by:shieldsco
ID: 40368348
Error Message can' find the field referenced in the expression:

If DCount("*", ([tbl_Accounting_Events]), "[Event Class]='" & Me.Event_Class & "'") = 0 Then
     MsgBox "No records"
     Exit Sub
 Else
 'open form


 DoCmd.OpenForm "frm_Accounting_Events", , , "[Event Class]='" & Me.Event_Class & "'"

 End If
0
 
LVL 24

Expert Comment

by:Bitsqueezer
ID: 40368360
Hi,

you must enclose that in double quotes:
DCount("*", "tbl_Accounting_Events", "[Event Class]='" & Me.Event_Class & "'")

Open in new window


Cheers,

Christian
0
 

Author Closing Comment

by:shieldsco
ID: 40368378
Thanks -- Very Good
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question