472,354 Members | 2,245 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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 1990
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.NAME, "T-TFD") & " AND [T-TFC]![T-TAB-ID]=" &
TabDctoID(FRM.Tag)) = 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.NAME, "T-TFD") & " AND [T-TFC]![T-TAB-ID]=" &
TabDctoID(FRM.Tag)) = 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.NAME, "T-TFD") & " AND [T-TFC]![T-TAB-ID]=" &
TabDctoID(FRM.Tag)) ' 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(DataErr 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
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: ...
0
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...
5
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...
351
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...
7
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...
12
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...
2
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
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...
14
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; ...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made but the http to https rule only works for...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...

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.