473,746 Members | 2,226 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

making an error more meaningful....

Hi,

I am trying to make errors a bit more meaningful for my users.

I am trying to fix error 3201 where there is a missing field in a form.

If I do not do any error trapping, then I get

You cannot add or change a record because a related record is required in
table 'my table name'.

All I wanted to do is to change my table name to something more meaningful
in onerror event. However, when I access the message there, I get:

You cannot add or change a record because a related record is required in
table '|'.

Does anyone know how this works?

TIA

- Nicolaas
Nov 13 '05 #1
3 2063
I am new to this group, but here are a few links that I found when I
searched on "error 3201", hopefully they might help.

http://groups-beta.google.com/group/...bf0685a81b7cd8

this person was nice enough to post their solution: (close to the
bottom, same error statement you recieved.)
http://groups-beta.google.com/group/...4f5503179589d4

Nov 13 '05 #2
windandwaves wrote:
Hi,

I am trying to make errors a bit more meaningful for my users.

I am trying to fix error 3201 where there is a missing field in a form.

If I do not do any error trapping, then I get

You cannot add or change a record because a related record is required in
table 'my table name'.

All I wanted to do is to change my table name to something more meaningful
in onerror event. However, when I access the message there, I get:

You cannot add or change a record because a related record is required in
table '|'.

Does anyone know how this works?

TIA

- Nicolaas

Since I'm not sure where it's called...
In the forms OnError event, maybe something like
If Dataerr = 3021 then
or in a OnError event
If Err.Number = 3021 then
and then put in the error message of your own fashion. Will that work?

3021 seems to be about a current record not being available.
Nov 13 '05 #3
Salad wrote:

[snip] [snip] [snip] [snip] [snip] [snip]

thank you both for your comments...

Here is the final function I wrote:

Public Function FMFEH(n) As Long
'form most frequent error handling
'On Error GoTo er
'-
Dim FRM As Form
Dim Ctl As Control
Dim S As String
Dim C As Long
Dim FldD As String
Dim FldN As String
Dim OK As Boolean
'-
FMFEH = True
Select Case n
Case 3201, 3314
S = FINTXT(307) & vbCr & vbLf & vbCr & vbLf
C = 0
If Not (SCFAF Is Nothing) Then
Set FRM = SCFAF
For Each Ctl In FRM.Section(0). Controls
If eCount("[ID]", "[T-TFC]", "[T-TFC]![T-TFD-ID]=" &
TabDctoID(Ctl.N AME, "T-TFD") & " AND [T-TFC]![T-TAB-ID]=" &
TabDctoID(FRM.T ag)) = 1 Then ' T-TFC = a table in which I store data about
the fields, here i check for an entry
If Ctl.Visible = True Then
If Ctl.Width > 0 Then
If NZZ(Ctl.Value) = False Then
Select Case Ctl.ControlType
Case acComboBox
If Ctl.LimitToList = True Then
OK = True
Else
OK = False
End If
Case acTextBox
If eLookup("[UNI]", "[T-TFC]", "[T-TFC]![T-TFD-ID]="
& TabDctoID(Ctl.N AME, "T-TFD") & " AND [T-TFC]![T-TAB-ID]=" &
TabDctoID(FRM.T ag)) = True Then ' T-TFC = a table in which I store data
about the fields' requirements (e.g. unique index combo)
OK = True
Else
OK = False
End If 'other stuff
Case Else
OK = False
End Select
Else
OK = False
End If
If OK = True Then
FldD = eLookup("[D]", "[T-TFC]", "[T-TFC]![T-TFD-ID]=" &
TabDctoID(Ctl.N AME, "T-TFD") & " AND [T-TFC]![T-TAB-ID]=" &
TabDctoID(FRM.T ag)) ' T-TFC = a table in which I store data about the
fields' names
If C > 0 Then
S = S & " AND ALSO "
C = C + 1
End If
S = S & FldD & vbCr & vbLf & vbCr & vbLf
Ctl.OnLostFocus = "=CRBAE(" & Ctl.BorderColor & ")"
Ctl.BorderColor = RGB(255, 0, 0)
End If
End If
End If
End If
Next Ctl
End If
msgbox S
FMFEH = False
Case 3022
msgbox "info about duplicate records"
FMFEH = False
Case Else
FMFEH = True
End Select
xt:
Exit Function
er:
FMFEH = True
Resume xt
End Function
=============== =============== =
and I add the following to each form
=============== =============== =

for each frm in ....

set frm = ..

set mdl = frm.module
x = 1
MDL.InsertLines x, "option compare database": x = x + 1
MDL.InsertLines x, "Option Explicit": x = x + 1
MDL.InsertLines x, "Private Sub Form_Error(Data Err As Integer, Response
As Integer)": x = x + 1
MDL.InsertLines x, " Response = FMFEH(DataErr)" : x = x + 1
MDL.InsertLines x, "End Sub": x = x + 1

next frm
Nov 13 '05 #4

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

Similar topics

8
2943
by: Nicolás Lichtmaier | last post by:
Hi, some time ago I've written an article about this issue. It explain some differences in Explorer's and Mozilla's JavaScript/DOM. It has recently changed its URL, This is the new one: http://www.reloco.com.ar/mozilla/compat.html Bye! PS: I hope it's useful to someone. I would appreciate any comments and suggestions!
0
910
by: Joshua Ellul | last post by:
Hi, I am creating a web service that returns a double value.... if however, one of the user passed parameters are incorrect I would like to return to the user a meaningful message (rather than a -1 for example)... I believe this can be done by using SOAP messages.... Could anyone guide me to a simple example of using such a message within the web service?
5
1559
by: Jon Guyer | last post by:
>>> This is a fake line to confuse the stupid top-posting filter at gmane We have a rather complicated class that, under certain circumstances, knows that it cannot perform various arithmetic operations, and so returns NotImplemented. As a trivial example: >>> class my: ... def __mul__(self, other): ... return NotImplemented ...
351
13051
by: CBFalconer | last post by:
We often find hidden, and totally unnecessary, assumptions being made in code. The following leans heavily on one particular example, which happens to be in C. However similar things can (and do) occur in any language. These assumptions are generally made because of familiarity with the language. As a non-code example, consider the idea that the faulty code is written by blackguards bent on foulling the language. The term...
7
2026
by: jacob navia | last post by:
Microsoft proposed recently (In the Technical Report 24173 presented to the Standards Comitee) a change in the C library in the sense of more security. Basically, missing size information is passed to the new primitives like strcat_s(), gets_s(), and many others. The good thing in this proposal is that the specifications of the new library are much more precise than in the existing library, an improvement that made me start...
12
1200
by: Ron M. Newman | last post by:
hi, without going case-by-case, how do I know a "ToString" method returns useful information, like for Sytem.Int32, or useless information like for System.Drawing.Bitmap (returning the name of the class). Ron
2
4375
by: Srini | last post by:
Hi, Can anyone please tell me how to retrieve meaningful value from registry value in REG_Binary type? I tried to convert REG_Binary value to string using the following code.
18
1796
by: pereges | last post by:
Hi, I'm thinking of having a seperate module in my project that deals with the exceptions and errors as they occur in a C program. Is this a good idea ? I thought of doing this because it is getting really repetitive to have the same thing in my code over and voer again eg. if malloc fails then: int *p; p = malloc(sizeof(int) * 5);
14
3411
by: Mike Copeland | last post by:
I'm getting a syntax error on the "typedef" code line here. Any thoughts on why? TIA struct CSTYPE { // City/State Record string csKey; // City/State "Key" string csCity; // City string csState; // State Code };
0
9346
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...
1
9279
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9214
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
6763
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
6057
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
4573
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4827
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3287
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
3
2195
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.