473,385 Members | 1,814 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,385 software developers and data experts.

Can't suppress warnings!

Hi,

I have this Access 2003 DB that handles Clients and their respective
items of correspondence in a one to many relationship. Clients details
are entered in frmPerson. When it comes to recording an item of
correspondence this is done via another form/subform ( main form is
called frmLetterDetail ). This main form summarises the Client's
details and the subform gives details of each individual item of
correspondence displayed as single forms rather than continuous
forms..

The arrangement to entering new correspondence is to navigate to the
appropriate Person using the PersonID as the Link criteria and then
have the suform open at a new ( blank) record. This works fine when
the person already has one item of correspondence but I get the get
the error message "No current record" whenever I try to enter the
first item of correspondence. After clearing off the error message it
opens at a blank record on the sbform - just as it should do.

Dim frm As Form 'Reference to the subform.
DoCmd.OpenForm "frmLetterDetail", _
WhereCondition:="PersonID = " & Me.PersonID
Forms!FrmLetterDetail!frmSubDetail.SetFocus

DoCmd.SetWarnings False
DoCmd.GoToRecord , , acNewRec

DoCmd.SetWarnings True

If only I could get these warnings suppressed then I'd be delighted.

When I approach the same result from a different form I get the
message - "You can't go to the specified record". And again, where
the person already has an item of correspondence, then there is no
error message.

Thanks in advance, Yvonne.

Sep 13 '07 #1
5 4104
Yvonne wrote:
Hi,

I have this Access 2003 DB that handles Clients and their respective
items of correspondence in a one to many relationship. Clients details
are entered in frmPerson. When it comes to recording an item of
correspondence this is done via another form/subform ( main form is
called frmLetterDetail ). This main form summarises the Client's
details and the subform gives details of each individual item of
correspondence displayed as single forms rather than continuous
forms..

The arrangement to entering new correspondence is to navigate to the
appropriate Person using the PersonID as the Link criteria and then
have the suform open at a new ( blank) record. This works fine when
the person already has one item of correspondence but I get the get
the error message "No current record" whenever I try to enter the
first item of correspondence. After clearing off the error message it
opens at a blank record on the sbform - just as it should do.

Dim frm As Form 'Reference to the subform.
DoCmd.OpenForm "frmLetterDetail", _
WhereCondition:="PersonID = " & Me.PersonID
Forms!FrmLetterDetail!frmSubDetail.SetFocus

DoCmd.SetWarnings False
DoCmd.GoToRecord , , acNewRec

DoCmd.SetWarnings True

If only I could get these warnings suppressed then I'd be delighted.

When I approach the same result from a different form I get the
message - "You can't go to the specified record". And again, where
the person already has an item of correspondence, then there is no
error message.

Thanks in advance, Yvonne.
In the form's property sheet, under Events, there's an OnError event.
You could enter something like
msgbox "SF " & DataErr
in the subform. Change the message for the main form.

If you get that error when you go to new record then you can trap for
it. Like
If DataErr = 1234 then response = acdataerrcontinue

If that helps, it really does not correct the problem...simply hides it.
Sep 13 '07 #2
>
In the form's property sheet, under Events, there's an OnError event.
You could enter something like
msgbox "SF " & DataErr
in the subform. Change the message for the main form.

If you get that error when you go to new record then you can trap for
it. Like
If DataErr = 1234 then response = acdataerrcontinue

If that helps, it really does not correct the problem...simply hides it.- Hide quoted text -

- Show quoted text -
Hi Salad,

'I wasn't quite able to implement your first fix - being a relative
newbie and with the second, the problem doesn't give an error number
so I couldn't trap it.

You got me thinking though and what I have done is take out the MsgBox
Err.Description line in the On Open Event :-
Err_Open_:

'MsgBox Err.Description
Resume Exit_Open_
Hopefully, this will not have too many adverse implications
subsequently!

Thanks, Yvonne

End Sub

Sep 13 '07 #3
Yvonne wrote:
>>In the form's property sheet, under Events, there's an OnError event.
You could enter something like
msgbox "SF " & DataErr
in the subform. Change the message for the main form.

If you get that error when you go to new record then you can trap for
it. Like
If DataErr = 1234 then response = acdataerrcontinue

If that helps, it really does not correct the problem...simply hides it.- Hide quoted text -

- Show quoted text -

Hi Salad,

'I wasn't quite able to implement your first fix - being a relative
newbie and with the second, the problem doesn't give an error number
so I couldn't trap it.

You got me thinking though and what I have done is take out the MsgBox
Err.Description line in the On Open Event :-
Err_Open_:

'MsgBox Err.Description
Resume Exit_Open_
Hopefully, this will not have too many adverse implications
subsequently!

Thanks, Yvonne

End Sub
Yes, that will work. However, you might want to do this instead. Change
MsgBox Err.Description
to
MsgBox err.number & " " & Err.Description

Write the err.number down. Then change the code to

Err_Open_:
if err.number <WhatWasThatNumberYouWroteDown then
MsgBox Err.number & " " & Err.Description
Endif
Resume Exit_Open_

This ignores the current error you have but will trap for other errors
that could occur.

It's handy to know the error numbers. That way if you ever contact this
newsgroup about an error, we can find the error number easier than
searching the errors list for the description.

BTW, the DataErr stuff is something to remember if an error occurs that
is not part of an OnError routine in a sub or function. Go to the
form's property, select Events tab, and find OnError at the bottom of
the list. Click in the row and press F1 to read more about it.
Sep 13 '07 #4
>
Yes, that will work. However, you might want to do this instead. Change
MsgBox Err.Description
to
MsgBox err.number & " " & Err.Description

Write the err.number down. Then change the code to

Err_Open_:
if err.number <WhatWasThatNumberYouWroteDown then
MsgBox Err.number & " " & Err.Description
Endif
Resume Exit_Open_

This ignores the current error you have but will trap for other errors
that could occur.

It's handy to know the error numbers. That way if you ever contact this
newsgroup about an error, we can find the error number easier than
searching the errors list for the description.

BTW, the DataErr stuff is something to remember if an error occurs that
is not part of an OnError routine in a sub or function. Go to the
form's property, select Events tab, and find OnError at the bottom of
the list. Click in the row and press F1 to read more about it.- Hide quoted text -

- Show quoted text -
Salad.

That worked a treat ! The error was 2105 and now is it suppressed.

Many thanks for the most comprehensive and effective response. It is
greatly appreciated.

Yvonne


Sep 13 '07 #5
Yvonne wrote:
>>Yes, that will work. However, you might want to do this instead. Change
MsgBox Err.Description
to
MsgBox err.number & " " & Err.Description

Write the err.number down. Then change the code to

Err_Open_:
if err.number <WhatWasThatNumberYouWroteDown then
MsgBox Err.number & " " & Err.Description
Endif
Resume Exit_Open_

This ignores the current error you have but will trap for other errors
that could occur.

It's handy to know the error numbers. That way if you ever contact this
newsgroup about an error, we can find the error number easier than
searching the errors list for the description.

BTW, the DataErr stuff is something to remember if an error occurs that
is not part of an OnError routine in a sub or function. Go to the
form's property, select Events tab, and find OnError at the bottom of
the list. Click in the row and press F1 to read more about it.- Hide quoted text -

- Show quoted text -


Salad.

That worked a treat ! The error was 2105 and now is it suppressed.

Many thanks for the most comprehensive and effective response. It is
greatly appreciated.

Yvonne
Ahhhh...the old 2105 gotcha! It's one you may want to remember. Let's
say you open a FormB from FormA. And in FormB's OnOpen event you do
some checking and if the validatation doesn't pass you cancel the Open
event. When you return to the sub in FormA that opened FormB you'll get
a 2105 operation canceled message.

If you call subs with a Cancel operation (look at the OnOpen event of
any form, you'll see the word Cancel as an argument) you might want to
display all errors except the 2105. IOW, any subs that call another sub
and that called sub has a Cancel As Integer as one of its arguments.

Sep 13 '07 #6

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

Similar topics

7
by: Pete Forman | last post by:
I'm new to PHP and trying to get a handle on some basics. require() and include() both load up a file. require() exits if the inclusion fails while include() issues a warning and the script...
6
by: Krishna Srinivasan | last post by:
I have a form with check boxes. When accessing a check box element that is not checked, I get a notice (Notice: Undefined variable..). Is there a way to hide these notices and warning in PHP code...
1
by: Dan | last post by:
In a VS.NET 2003 project automatically generating the XML documentation on build I have some .CS files which lack comments as they are automatically created by tools (such as strongly typed DataSet...
3
by: Philipp Staempfli | last post by:
Hello I have a project which includes different libraries. When I compile the project, I get a huge amount of the following linker warnings: --- warning LNK4204: "C:\...\Debug\vc70.pdb' is...
7
by: John Nagle | last post by:
How do I suppress "DeprecationWarning: Old style callback, use cb_func(ok, store) instead". A library is triggering this message, the library is being fixed, but I need to make the message...
4
by: lory | last post by:
Hi, whan I have for example a vba script stSql = "INSERT INTO table..." DoCmd.RunSQL stSql associated with a command, and then I click on it there is an access popup that informs me how many...
3
by: =?Utf-8?B?RGFu?= | last post by:
I am new to VB.NET and Visual Studio 2005. I have several VB 6.0 programs to convert. When I convert one of them, I get a lot of warning messages. One of them is the following: Variable 'xyz' is...
2
by: Sergei Shelukhin | last post by:
Hi. I need to handle warnings in incorrect regular expressions executed using preg_match. Warnings shouldn't appear, instead I want to output some generic message like: "Bad regex: $regex" and...
5
by: Franz Von Bayros | last post by:
Hello all. I have some PHP scripts run by cron that email me all day for no good reason. The scripts are outputting warnings like: PHP Warning: Module 'mysql' already loaded in Unknown on...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.