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 3 2040
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.
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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:
...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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.
|
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...
|
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; ...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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...
|
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...
| |