473,734 Members | 2,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trapping/disabling runtime error 30014

Hello all -

This is driving me crazy. I have a table called tblClients - very
simple, has the following fields:

taxID (PK)
ClientName
SalesName

The main form of my application allows a user to select a client and
shows sales transactions on a subform. I wanted to include a button
the user could click which would allow them to edit the client
information. So, I created a form called frmEditClient which is loaded
when the button is clicked. Code on the OnClick event for the code
button:

Private Sub cmdEditClient_C lick()
Dim LinkCriteria As String
LinkCriteria = "[ClientName]= '" & Me.txtSelectedC Lient & "'"
DoCmd.OpenForm "frmEditClient" , , , LinkCriteria
End Sub

Pretty simple, just opens the EditClient form using the current client
in the recordsource - this opens the form and the user can edit
details and save the form. The recordsource of frmEditClient is a
query called vwEditClient that selects all from tblClients (tried
using tblClients as record source - same problem)

Only problem is if the user wants to edit the ClientName field - since
frmEditClient is using the ClientName field as a filter, I get a
runtime error 30014 - the data has been added but cannot be displayed
because it no longer meets the criteria of the underlying
recordsource.

I know *why* I'm getting the error, I just want to stop it. I've tried
to trap the damn thing, but can't seem to get it to trap - the error
is generated on the "me.dirty=false " line, and this stops any code
after from running. I have tried to put On Error Goto 0 at the
beginning of the sub, etc..., but nothing seems to trigger.

Here is the code for the Save button, without any error handling:

Private Sub cmdSave_Click()
If Me.Dirty Then
Me.Dirty = False
Else
MsgBox ("No changes were detected - please make your changes, or
hit Cancel to return to the previous screen")
Exit Sub
End If
DoCmd.Close acForm, "frmEditCli ent"
End Sub

All I want is:

1) A way to load the frmEditClient so the form displays the client
that was selected on the main form
2) A way to suppress or hide the runtime error that occurs when the
user edits the clientname.

Can someone assist with a way to trap this error or prevent it from
happening?

Thanks
Jun 27 '08 #1
3 5183
On May 5, 3:38*pm, Jim Armstrong <armstron...@ho tmail.comwrote:
Hello all -

This is driving me crazy. I have a table called tblClients - very
simple, has the following fields:

taxID (PK)
ClientName
SalesName

The main form of my application allows a user to select a client and
shows sales transactions on a subform. I wanted to include a button
the user could click which would allow them to edit the client
information. So, I created a form called frmEditClient which is loaded
when the button is clicked. Code on the OnClick event for the code
button:

Private Sub cmdEditClient_C lick()
Dim LinkCriteria As String
LinkCriteria = "[ClientName]= '" & Me.txtSelectedC Lient & "'"
DoCmd.OpenForm "frmEditClient" , , , LinkCriteria
End Sub

Pretty simple, just opens the EditClient form using the current client
in the recordsource - this opens the form and the user can edit
details and save the form. The recordsource of frmEditClient is a
query called vwEditClient that selects all from tblClients (tried
using tblClients as record source - same problem)

Only problem is if the user wants to edit the ClientName field - since
frmEditClient is using the ClientName field as a filter, I get a
runtime error 30014 - the data has been added but cannot be displayed
because it no longer meets the criteria of the underlying
recordsource.

I know *why* I'm getting the error, I just want to stop it. I've tried
to trap the damn thing, but can't seem to get it to trap - the error
is generated on the "me.dirty=false " line, and this stops any code
after from running. I have tried to put On Error Goto 0 at the
beginning of the sub, etc..., but nothing seems to trigger.

Here is the code for the Save button, without any error handling:

Private Sub cmdSave_Click()
If Me.Dirty Then
* * Me.Dirty = False
Else
* * MsgBox ("No changes were detected - please make your changes, or
hit Cancel to return to the previous screen")
* * Exit Sub
End If
DoCmd.Close acForm, "frmEditCli ent"
End Sub

All I want is:

1) A way to load the frmEditClient so the form displays the client
that was selected on the main form
2) A way to suppress or hide the runtime error that occurs when the
user edits the clientname.

Can someone assist with a way to trap this error or prevent it from
happening?

Thanks
Well, I still have not been able to trap the error, but I was able to
get around it using the resync property. Basically, I added the
following line in the Save button's On Click code:

Me.ResyncComman d = "SELECT * FROM vwEditClient WHERE TaxID=?"

Seems to work so far - but I'm still all ears if anyone has some
trapping code I could try or a reason the 30014 runtime was not picked
up by my attempts...

Thanks!
Jun 27 '08 #2
Jim Armstrong wrote:
On May 5, 3:38 pm, Jim Armstrong <armstron...@ho tmail.comwrote:
>>Hello all -

This is driving me crazy. I have a table called tblClients - very
simple, has the following fields:

taxID (PK)
ClientName
SalesName

The main form of my application allows a user to select a client and
shows sales transactions on a subform. I wanted to include a button
the user could click which would allow them to edit the client
information . So, I created a form called frmEditClient which is loaded
when the button is clicked. Code on the OnClick event for the code
button:

Private Sub cmdEditClient_C lick()
Dim LinkCriteria As String
LinkCriteri a = "[ClientName]= '" & Me.txtSelectedC Lient & "'"
DoCmd.OpenFor m "frmEditClient" , , , LinkCriteria
End Sub

Pretty simple, just opens the EditClient form using the current client
in the recordsource - this opens the form and the user can edit
details and save the form. The recordsource of frmEditClient is a
query called vwEditClient that selects all from tblClients (tried
using tblClients as record source - same problem)

Only problem is if the user wants to edit the ClientName field - since
frmEditClie nt is using the ClientName field as a filter, I get a
runtime error 30014 - the data has been added but cannot be displayed
because it no longer meets the criteria of the underlying
recordsourc e.

I know *why* I'm getting the error, I just want to stop it. I've tried
to trap the damn thing, but can't seem to get it to trap - the error
is generated on the "me.dirty=false " line, and this stops any code
after from running. I have tried to put On Error Goto 0 at the
beginning of the sub, etc..., but nothing seems to trigger.

Here is the code for the Save button, without any error handling:

Private Sub cmdSave_Click()
If Me.Dirty Then
Me.Dirty = False
Else
MsgBox ("No changes were detected - please make your changes, or
hit Cancel to return to the previous screen")
Exit Sub
End If
DoCmd.Close acForm, "frmEditCli ent"
End Sub

All I want is:

1) A way to load the frmEditClient so the form displays the client
that was selected on the main form
2) A way to suppress or hide the runtime error that occurs when the
user edits the clientname.

Can someone assist with a way to trap this error or prevent it from
happening?

Thanks


Well, I still have not been able to trap the error, but I was able to
get around it using the resync property. Basically, I added the
following line in the Save button's On Click code:

Me.ResyncComman d = "SELECT * FROM vwEditClient WHERE TaxID=?"

Seems to work so far - but I'm still all ears if anyone has some
trapping code I could try or a reason the 30014 runtime was not picked
up by my attempts...

Thanks!
There's on OnError event for the form. It's not a runtime VBA error. So
perhaps that's where that error is being generated. If so, in the error
routine try entering
If DataErr = 30014 then response = acdataerrcontin ue

Amore
http://www.youtube.com/watch?v=9FtuV3xMrN0
Jun 27 '08 #3
Jim Armstrong <ar*********@ho tmail.comwrote in news:0c3890c4-9c48-4d54-
96************* **@b64g2000hsa. googlegroups.co m:
On May 5, 3:38*pm, Jim Armstrong <armstron...@ho tmail.comwrote:
>Hello all -

This is driving me crazy. I have a table called tblClients - very
simple, has the following fields:

taxID (PK)
ClientName
SalesName

The main form of my application allows a user to select a client and
shows sales transactions on a subform. I wanted to include a button
the user could click which would allow them to edit the client
information. So, I created a form called frmEditClient which is loaded
when the button is clicked. Code on the OnClick event for the code
button:

Private Sub cmdEditClient_C lick()
Dim LinkCriteria As String
LinkCriteria = "[ClientName]= '" & Me.txtSelectedC Lient & "'"
DoCmd.OpenFo rm "frmEditClient" , , , LinkCriteria
End Sub

Pretty simple, just opens the EditClient form using the current client
in the recordsource - this opens the form and the user can edit
details and save the form. The recordsource of frmEditClient is a
query called vwEditClient that selects all from tblClients (tried
using tblClients as record source - same problem)

Only problem is if the user wants to edit the ClientName field - since
frmEditClien t is using the ClientName field as a filter, I get a
runtime error 30014 - the data has been added but cannot be displayed
because it no longer meets the criteria of the underlying
recordsource .

I know *why* I'm getting the error, I just want to stop it. I've tried
to trap the damn thing, but can't seem to get it to trap - the error
is generated on the "me.dirty=false " line, and this stops any code
after from running. I have tried to put On Error Goto 0 at the
beginning of the sub, etc..., but nothing seems to trigger.

Here is the code for the Save button, without any error handling:

Private Sub cmdSave_Click()
If Me.Dirty Then
* * Me.Dirty = False
Else
* * MsgBox ("No changes were detected - please make your changes, or
hit Cancel to return to the previous screen")
* * Exit Sub
End If
DoCmd.Close acForm, "frmEditCli ent"
End Sub

All I want is:

1) A way to load the frmEditClient so the form displays the client
that was selected on the main form
2) A way to suppress or hide the runtime error that occurs when the
user edits the clientname.

Can someone assist with a way to trap this error or prevent it from
happening?

Thanks

Well, I still have not been able to trap the error, but I was able to
get around it using the resync property. Basically, I added the
following line in the Save button's On Click code:

Me.ResyncComman d = "SELECT * FROM vwEditClient WHERE TaxID=?"

Seems to work so far - but I'm still all ears if anyone has some
trapping code I could try or a reason the 30014 runtime was not picked
up by my attempts...

Thanks!
Try using On Error Resume Next just prior to the Me.Dirty = False
statement. That should let you then examine the Err.Number (if 13004,
resume, if anything else do something).

Do you have Error Handling set to Break on Unhandled Errors?

You can't trap an error AS it is happening, you can only respond to it
after the fact.

The reason you're having so much trouble is that it is the equivalent of
sawing off the branch while standing on it. As soon as you change the
ClientName, the record *should* vanish (since it is not within the filter
criteria. Access detects this as a logical impossibility and throws the
error.

Instead, you might try declaring a Public string variable in the module
area of the original form. Store the original value of ClientName. Open
frmEditClient as a dialog (acDialog) and when you close frmEditClient,
store the new value into the Public variable. Then compare the ClientName
textbox value with the Public variable. If different, replace ClientName
with the new value.

Jun 27 '08 #4

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

Similar topics

8
3377
by: Pete | last post by:
I'm trying to improve my code so that when I open a recordset object, I can absolutely guarantee it is closed and is set = Nothing. I have read some old threads and they all say to use the functional equivalent of the following code: Public Sub CloseRecordset() On Error GoTo Sub_Error Dim rs As Recordset rs.FindFirst "This Will Error"
3
4620
by: Paul | last post by:
I have an Access 2000 database with a form that is giving me some major headaches. When you open the form, it displays all records and allows editing, but has AllowAdditions set to False so that the user has to use my New Record button. When you click the New Record button, the form presents a new record for editing. My client wants to use the Escape key to cancel changes to new or existing records. On existing records, Access already...
3
6898
by: Nathan Bloomfield | last post by:
Hi there, I am having difficulty with a piece of code which would work wonders for my application if only the error trapping worked properly. Basically, it works as follows: - adds records from rsSource into rsDest - if it finds a key violation then it deletes the current record from rsDest and adds the new record from rsSource. This works perfectly - but only for the first found duplicate record, it brings up the error
13
4483
by: Thelma Lubkin | last post by:
I use code extensively; I probably overuse it. But I've been using error trapping very sparingly, and now I've been trapped by that. A form that works for me on the system I'm using, apparently runs into problems on the system where it will actually be used, and since I used so little error-trapping it dies very ungracefully. I will of course try to fix whatever is causing the error and add error-trapping to the functions where the...
4
2101
by: Bill | last post by:
Despite our best efforts occasionally in an aspx file, something like <%=x%> where x is not defined sqeaks by and I get the ugly asp error message. I want to be able to identify this particular error and issue a pretty message. I use the global.asax on application error to handle generalized error handling. I want to be able to capture and identify the above error.
12
2267
by: Nalaka | last post by:
Hi, I suddenly started getting a lot of errors from html validation (some CSS) so I followed the following instructions to disable it. If you'd rather not have these types of HTML validation errors show up in your error-list, you can disable this functionality by selecting the Tools->Options menu item in VS or Visual Web Developer. Select the TextEditor->Html->Validation tree option in the left-hand side of the
2
3876
by: Captain Nemo | last post by:
I'm still using Office 2000 myself, but some of my clients have Office 2003. I've recently added a piece of code to create an instance of Word, open a document, fill in the blanks and become visible so the document can be printed and/or modified. This all takes place within one form, in which the Word.Application and Word.Document objects are both private form-level variables. Just to be on the safe side I included this piece of code in...
9
2109
by: 47computers | last post by:
Pretty new to PHP, I recently started learning about error trapping. As of right now, I include the following into a page in my website: -------BEGIN PASTE-------- error_reporting(E_ERROR | E_PARSE); set_error_handler("SendErrorReport"); function SendErrorReport($errorNumber, $errorMessage, $errorFile, $errorLine, $vars) {
0
1769
by: ajb123 | last post by:
I am encountering an R6025 ("No object has been instantiated to handle the pure virtual function call") error in a complex application. The error is intermittent and it is time consuming to reproduce. I have read that setting a breakpoint in purevirt.c at the line "_amsg_exit(_RT_PUREVIRT);" will trap the error, but when I attach to my application, the debugger does not stop. I tried to deliberately reproduce the same error in a much...
0
8776
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9310
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9182
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6735
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6031
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2724
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.