473,394 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

turn off warning

ken
Hi,
How do you turn of the warning that you get "Can't go to specified
record" when you use custom navication buttons which have the following
code:DoCmd.GoToRecord , , acPrevious or DoCmd.GoToRecord , , acNext

Thanks

Nov 13 '05 #1
4 6109
docmd.SetWarnings False
'do your thing
docmd.SetWarnings True

but remember to turn the warnings back on in your error handling code,
because otherwise all messages will be suppressed.

Nov 13 '05 #2
ken
It still does that. I think because its not a warning, but an error
that I'm getting.
Here is my code
On Error GoTo Err_BUT_PREV_REC_Click
DoCmd.SetWarnings False
DoCmd.GoToRecord , , acPrevious
DoCmd.SetWarnings True

Exit_BUT_PREV_REC_Click:
Exit Sub

Err_BUT_PREV_REC_Click:
MsgBox Err.Description
Resume Exit_BUT_PREV_REC_Click

End Sub

After the second docmd that tells the form to go back one...it goes to
the err handler.

There is no error number though...just a message "Can't go to specified
record" with an ok button.

Nov 13 '05 #3
According to help:

'You can use this action to prevent modal warnings and message boxes from
stopping the macro. However, error messages are always displayed.'

Mostly I've used SetWarnings False to disable, er, warnings before deleting
records and similar. In other words to hide the 'are you sure' type
messages. Yours isn't an 'are you sure' type message, more a sort of 'enough
already, there ain't no more goddam records, ok buddy?' type message.

Anyway, if you've gone to the trouble of writing custom navigation buttons,
you should catch the no-previous-record and no-next-record cases for the
first and last records, otherwise you've got even less functionality than
the built in access nav buttons.

Oh, and by the way, although SetWarnings probably isn't going to work here,
if you do use it in the future, remember to put a SetWarnings True in your
exit sub, otherwise if the error occurs after the false but before the true
then warnings will still be off.

Sam

"ken" <ge****@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
It still does that. I think because its not a warning, but an error
that I'm getting.
Here is my code
On Error GoTo Err_BUT_PREV_REC_Click
DoCmd.SetWarnings False
DoCmd.GoToRecord , , acPrevious
DoCmd.SetWarnings True

Exit_BUT_PREV_REC_Click:
Exit Sub

Err_BUT_PREV_REC_Click:
MsgBox Err.Description
Resume Exit_BUT_PREV_REC_Click

End Sub

After the second docmd that tells the form to go back one...it goes to
the err handler.

There is no error number though...just a message "Can't go to specified
record" with an ok button.

Nov 13 '05 #4
ken wrote:
It still does that. I think because its not a warning, but an error
that I'm getting.
Here is my code
On Error GoTo Err_BUT_PREV_REC_Click
DoCmd.SetWarnings False
DoCmd.GoToRecord , , acPrevious
DoCmd.SetWarnings True

Exit_BUT_PREV_REC_Click:
Exit Sub

Err_BUT_PREV_REC_Click:
MsgBox Err.Description
Resume Exit_BUT_PREV_REC_Click

End Sub

After the second docmd that tells the form to go back one...it goes to
the err handler.

There is no error number though...just a message "Can't go to specified
record" with an ok button.


Why don't you present the err number? Ex:
MsgBox Err.Number & " " & Err.Description

Now you can trap for it. For example
Err_BUT_PREV_REC_Click:
If err.Number <> 2105 then MsgBox Err.Description
Resume Exit_BUT_PREV_REC_Click
Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: joes | last post by:
Hello I am using tomcat 3.3.1 for an intranet application with other third party software. Unfortunately I have to remove from the web.xml the web-app valiadtion, because of the old third party...
1
by: Bill Sun | last post by:
Hi, Who can tell me how to turn off the annoying link warning, like this: Xxxx.lib(read_dose.obj) : warning LNK4204: '......xxxx\vc70.pdb' is missing debugging information for referencing module;...
2
by: Bob | last post by:
In the following code, when the DELETE line is executed I get a dialog asking if I want to delete or to cancel. How do I turn it off? Also when the first CLOSE line is executed, the application so...
1
by: Maxwell2006 | last post by:
Hi, How can I turn off the compiler warnings in some specific spots in the code? I don't want to turn off warnings for all project. I remember we had PRAGMA feature in C++. Do we have the...
2
by: chris.fairles | last post by:
So I took a look at assert.h because I knew it uses -DNDEBUG to turn off its assert statements but it does some funky stuff that I don't quite understand. I made my own def's something like: ...
4
by: no_spam_for_gman | last post by:
Hi, I can turn off autocommit within the command window but I cannot figure out how to turn it off when you are in the IBM DB2 Command Line Processor. Does anybody knows how? By the way I mean...
24
by: marcwentink | last post by:
Is there a way to turn off depreacted warnings in Visual Studio 2005, Professional Edition? I've got this VB project ported from version 2003 to 2005, I am a bit cautious to already changing the...
2
by: brino | last post by:
hi all ! i am using a hyperlink to open another database from the database that is being used by my client. when the client does this it brings up a warning message about opening hyperlinks...
3
LacrosseB0ss
by: LacrosseB0ss | last post by:
Quick question: is there a way to programmatically turn off the warning message for macros in Excel? (Macros can be harmful ... enable/disable) The reason for the question is on our intranet page...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.