A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Message box question



 
 
Thread Tools Display Modes
  #1  
Old October 16th, 2009, 04:15 PM posted to microsoft.public.access.forms
hotplate
external usenet poster
 
Posts: 55
Default Message box question

Is there a way that I can display a message using msgbox that after a
field is populated, the records are searched for the same entry and
give a count.

Something like:

msgbox "There are " (insert count here) "records that have the same
information."

Thanks
James
  #2  
Old October 16th, 2009, 04:32 PM posted to microsoft.public.access.forms
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Message box question

"hotplate" wrote in message
...
Is there a way that I can display a message using msgbox that after a
field is populated, the records are searched for the same entry and
give a count.

Something like:

msgbox "There are " (insert count here) "records that have the same
information."

Thanks
James



You'd probably use the control's AfterUpdate event, and use DCount to find
out how many matching records there are. Something like:

'------ start of example code ------
Private Sub YourControlName_AfterUpdate()

Dim lngCount As Long

lngCount = _
DCount("*", "YourTableName", _
"YourFieldName=[Forms]![YourFormName]![YourControlName]")

MsgBox _
"There are " & lngCount & "records that have the same information."

End Sub
'------ end of example code ------

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:21 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.