Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access 2010 Message Box

Posted on 2014-10-08
4
Medium Priority
?
328 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
[X]
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
  • 2
4 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

670 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