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 (Getting 2 boxes)



 
 
Thread Tools Display Modes
  #1  
Old June 8th, 2004, 03:18 PM
Andy
external usenet poster
 
Posts: n/a
Default Message Box (Getting 2 boxes)

Hi;

I created a Public Function for "Not In List" with a Msgbox and only an "Ok"
button.
Want to use the same Msgbox response in several "Not In List".

It works correctly in a Sub procedu
Private Sub cbxName_NotInList(NewData As String, Response As Integer)
MsgBox "Custom Message."
Response = acDataErrContinue
End Sub

but when used as a Function and the "Ok" button is clicked in the custom
Msgbox, Access's own internal msgbox then pops up.

How do you get only the msgbox that you want to display.

Searched microsft's Access support center. Nothing even close.

Thanks in Advance.

Andy


  #2  
Old June 9th, 2004, 04:30 PM
Dirk Goldgar
external usenet poster
 
Posts: n/a
Default Message Box (Getting 2 boxes)

"Andy" wrote in message

Hi;

I created a Public Function for "Not In List" with a Msgbox and only
an "Ok" button.
Want to use the same Msgbox response in several "Not In List".

It works correctly in a Sub procedu
Private Sub cbxName_NotInList(NewData As String, Response As Integer)
MsgBox "Custom Message."
Response = acDataErrContinue
End Sub

but when used as a Function and the "Ok" button is clicked in the
custom Msgbox, Access's own internal msgbox then pops up.

How do you get only the msgbox that you want to display.

Searched microsft's Access support center. Nothing even close.

Thanks in Advance.

Andy


What is the code for your public function, and how are you calling it?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


  #3  
Old June 9th, 2004, 08:25 PM
Andy
external usenet poster
 
Posts: n/a
Default Message Box (Getting 2 boxes)

Dirk;

Public Function CustomMsgBox()
MsgBox "Custom Message."
Response = acDataErrContinue
End Function

And it' called from the "On Not In List" Event.
=CustomMsgBox()

It calls correctly, but after clicking the Ok button from that msgbox
getting "internal" msgbox informing that the item is not in the list. How
do you get only the CustomMsgBox?

Searched Microsoft's KB and all of Msft. With at least 40 different
combinations of words on the first day, and another 30 or so the second.
Sent an e-mail to telling them that nothing even
comes close to what I'm searching for.

For instance, searched for:
Access 2000 user-defined MESSAGE BOX FOR ON NOT IN LIST

That returned among many others just as obscu
PRB: Error Message "Unspecified Error Was Not Handled" When You Use Visual
InterDev to Debug ASP Page

Thanks.

Andy

"Dirk Goldgar" wrote in message
...
"Andy" wrote in message

Hi;

I created a Public Function for "Not In List" with a Msgbox and only
an "Ok" button.
Want to use the same Msgbox response in several "Not In List".

It works correctly in a Sub procedu
Private Sub cbxName_NotInList(NewData As String, Response As Integer)
MsgBox "Custom Message."
Response = acDataErrContinue
End Sub

but when used as a Function and the "Ok" button is clicked in the
custom Msgbox, Access's own internal msgbox then pops up.

How do you get only the msgbox that you want to display.

Searched microsft's Access support center. Nothing even close.

Thanks in Advance.

Andy


What is the code for your public function, and how are you calling it?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)




  #4  
Old June 9th, 2004, 09:04 PM
Dirk Goldgar
external usenet poster
 
Posts: n/a
Default Message Box (Getting 2 boxes)

"Andy" wrote in message

Dirk;

Public Function CustomMsgBox()
MsgBox "Custom Message."
Response = acDataErrContinue
End Function

And it' called from the "On Not In List" Event.
=CustomMsgBox()

It calls correctly, but after clicking the Ok button from that msgbox
getting "internal" msgbox informing that the item is not in the list.
How do you get only the CustomMsgBox?


The problem is that the Response argument is only available within an
event procedure that is called directly by the event handler. I don't
think you can use your public function in this fashion, because the
inline call, "=CustomMsgBox()", isn't going to have the same parameter
linkage to the event handling code that a true event procedure does. I
believe you're going to have to have an actual event procedure for each
control where you want to handle the NotInList event this way. You
could still put the custom message box code in a separate function, but
it's going to end up being something like this:

'----- code in a standard module -----
Public Function CustomMsgBox()
MsgBox "Custom Message."
End Function
'----- end standard-module code -----

'----- code in various form modules -----
Private Sub cboCombo1_NotInList( _
NewData As String, Response As Integer)

Call CustomMsgBox

Response = acDataErrContinue

End Sub

Private Sub cboCombo2_NotInList( _
NewData As String, Response As Integer)

Call CustomMsgBox

Response = acDataErrContinue

End Sub

'----- end code in various form modules -----

So each combo box would have to have an actual event procedure.

Searched Microsoft's KB and all of Msft. With at least 40 different
combinations of words on the first day, and another 30 or so the
second. Sent an e-mail to telling them that
nothing even comes close to what I'm searching for.

For instance, searched for:
Access 2000 user-defined MESSAGE BOX FOR ON NOT IN LIST

That returned among many others just as obscu
PRB: Error Message "Unspecified Error Was Not Handled" When You Use
Visual InterDev to Debug ASP Page


I don't know what I'd search for to have a hope of finding an answer for
a question like this. The answer I've given is implicit in the nature
of events and event procedures, but unless MS happened to have posted an
example somewhere and described it in those terms, I don't know how
you'd come up with it. Fortunately, there are newsgroups.

By the way, did you try searching Google Groups in the
mcirosoft.public.access.* hierarchy? That's also a very good place to
start.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


  #5  
Old June 10th, 2004, 03:50 PM
Andy
external usenet poster
 
Posts: n/a
Default Message Box (Getting 2 boxes)

Dirk;

Begining to think your answer is absolutely correct.about the Response
argument.

Tried: DoCmd.SetWarnings False
That didn't work either.

Thank You for Your help.

Perhaps I can return the favor some day.

Andy

"Dirk Goldgar" wrote in message
...
"Andy" wrote in message

Dirk;

Public Function CustomMsgBox()
MsgBox "Custom Message."
Response = acDataErrContinue
End Function

And it' called from the "On Not In List" Event.
=CustomMsgBox()

It calls correctly, but after clicking the Ok button from that msgbox
getting "internal" msgbox informing that the item is not in the list.
How do you get only the CustomMsgBox?


The problem is that the Response argument is only available within an
event procedure that is called directly by the event handler. I don't
think you can use your public function in this fashion, because the
inline call, "=CustomMsgBox()", isn't going to have the same parameter
linkage to the event handling code that a true event procedure does. I
believe you're going to have to have an actual event procedure for each
control where you want to handle the NotInList event this way. You
could still put the custom message box code in a separate function, but
it's going to end up being something like this:

'----- code in a standard module -----
Public Function CustomMsgBox()
MsgBox "Custom Message."
End Function
'----- end standard-module code -----

'----- code in various form modules -----
Private Sub cboCombo1_NotInList( _
NewData As String, Response As Integer)

Call CustomMsgBox

Response = acDataErrContinue

End Sub

Private Sub cboCombo2_NotInList( _
NewData As String, Response As Integer)

Call CustomMsgBox

Response = acDataErrContinue

End Sub

'----- end code in various form modules -----

So each combo box would have to have an actual event procedure.

Searched Microsoft's KB and all of Msft. With at least 40 different
combinations of words on the first day, and another 30 or so the
second. Sent an e-mail to telling them that
nothing even comes close to what I'm searching for.

For instance, searched for:
Access 2000 user-defined MESSAGE BOX FOR ON NOT IN LIST

That returned among many others just as obscu
PRB: Error Message "Unspecified Error Was Not Handled" When You Use
Visual InterDev to Debug ASP Page


I don't know what I'd search for to have a hope of finding an answer for
a question like this. The answer I've given is implicit in the nature
of events and event procedures, but unless MS happened to have posted an
example somewhere and described it in those terms, I don't know how
you'd come up with it. Fortunately, there are newsgroups.

By the way, did you try searching Google Groups in the
mcirosoft.public.access.* hierarchy? That's also a very good place to
start.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(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 06:32 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.