Access 2007 MsgBox for 10th Record

I am trying to create a msg box for every 10th record/id of a form/table.

ID name = DocketNum

Have tried to assign macro to the On Update event of the Form with the following code
[DocketNum] MOD 10 = 0
Msg "email data table"
Keeps saying DocketNum can't be found on the open object.  

Any ideas?
lachstockAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
On Update event ?

Can you post the entire code ...

mx
0
lachstockAuthor Commented:
sorry after update.

I have no idea when it comes to writting code, but here it is anyway.

Private Sub Form_AfterUpdate()
MsgBox "DocketNum=" & Me!DocketNum, Mod, 10, "Email Data Table"
End Sub

Thanks.
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Maybe this

Private Sub Form_AfterUpdate()
   IF Me!DocketNum Mod 10 = 0 then
        MsgBox "DocketNum= " & Me!DocketNum, "Email Data Table"
  End If
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

lachstockAuthor Commented:
sorry no good, input form with docketnum = 10 and no msgbox pops up......
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Well, the After Update event does not trigger until you save a record.  Maybe you want the Current event:


Private Sub Form_Current()
   IF Me!DocketNum Mod 10 = 0 then
        MsgBox "DocketNum= " & Me!DocketNum, "Email Data Table"
  End If
End Sub
0
lachstockAuthor Commented:
sorry still no good.  The Mod 10 = 0 should work right?
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Yes ... IF ... DocectNum has one or more values that are evenly divisible by 10.
What is the data type of DocectNum ?

Can you upload the db?

mx
0
lachstockAuthor Commented:
number, database uploaded.

XLD-Quality-Receipts.accdb
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
It's working for me ...

mx
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
0
lachstockAuthor Commented:
ok thats odd.....did you make any changes?
What could be the problem at my end?
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
No changes at all ... Well, I added one new record with DN of 22 ...

0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
0
lachstockAuthor Commented:
this is frustrating....still doesn't work for me.  Have tried trust center and enabling content etc....
So you have the following;
Private Sub Form_Current()
   If Me!DocketNum Mod 10 = 0 Then
        MsgBox "DocketNum= " & Me!DocketNum, "Email Data Table"
  End If
End Sub

I have also tried

Private Sub Form_Current()
   If Me!DocketNum Mod 10 = 0 Then
        MsgBox "Email Data Table"
  End If
End Sub

Have set up another test msg box on close, it works.  So nothing blocking the msgbox.  Just can't seem to match with the on current or after update event?
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Either of those work.  Yes, I suppose your db needs to be in a Trusted Location. There is nothing wrong with your code for the Current Event ...

Did you try the copy I uploaded - even though it's the same ..?

Do you have another machine you can try on ?

mx
0
lachstockAuthor Commented:
yes tried the one you uploaded, no good.
no other machine accessible at the moment.
0
als315Commented:
I have also tested DB and it is working (Access 2010)
0
Rahul SehrawatCommented:
Once I was facing the same problem in one of the project I was working on..
made the same changes in your project as well.. please check if it worked..
XLD-Quality-Receipts.accdb
0
mbizupCommented:
<<What could be the problem  >>

Possibly mis-communication?

When exactly do you want to see this message appear?

Your code is in the Current Event right now, which fires when the form opens and as the user navigates from record to record.  The message will pop up if the form opens to a record whose DocketNumber is a multiple of 10, and as the user navigates to such a record (the sample definitely behaves like that)

If you want the message to appear for DocketNumbers as the user enters new records, you could try placing that code in the AfterUpdate event of the Docket Number textbox.
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
"When exactly do you want to see this message appear?"
Not sure that matters.  My code works, proof see screen shot.  Does not work on his machine.

mx
0
lachstockAuthor Commented:
still not working, changes made by anshuverma didn't solve the issue.  I am using access 2007 though, would that be part of the problem?
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
" I am using access 2007 though, would that be part of the problem?"

There MUST .. be some nuance with A2007 that is keeping this from working.  Like there is nothing to that code ... about as simple as it gets.  Weird.

mx
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
"lachstock:

Using the db I uploaded, put a Break  Point right on the Form Current event, then use F8 to single step through that code ... and check the values, etc ...

mx
0
mbizupCommented:
The current event runs fine in 2007, as long as you have enabled macros /vba, which you have already confirmed you did.

Can you verify how you are using this ...navigating through records, adding new data, editing existing data, etc?

Just want to double check, per my last comment that you are indeed using the correct event.
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Yeah, maybe I should clarify ... I'm using the Nav buttons to move through the records - see image.

mx
Capture1.gif
0
lachstockAuthor Commented:
Turned out is was a simple as aligning the If and End if lines to the left (see below), they were indented/tabbed in in the solution.  Must be an access 2007 thing.....Thanks again for your help.  One more to go if keen;
See post
http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_27512064.html 

Private Sub Form_Current()
If Me!DocketNum Mod 10 = 0 Then
        MsgBox "Email Data Table"
End If
End Sub
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.