473,471 Members | 1,728 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

VB 6.0 Don't Add a New REcord

Hi:

I need to try this a different way.

I have a datagrid in VB 6.0 and the user can add new records. I want to
validate the record before it is saved and, if a particular cell is not
completed, I don't want the program to save the record when the user moves
off of it.

If I put code in the Before_Update event checking for the required data and
the data isn't there, I can do "Cancel = true"...then I get a message that
says "Action is Cancelled"... It doesn't allow me to put in my own message.
I can use vbdataerrcontinue, and the error message is not shown, but the
record is saved.

How do I keep the record from saving with my own message and not a "program"
error message?

Thanks for any assistance.

JP
Jul 17 '05 #1
4 9597

"Joe-Paul" <Ha*********@comcast.net> wrote in message
news:1c********************@comcast.com...

If I put code in the Before_Update event checking for the required data and
the data isn't there, I can do "Cancel = true"...then I get a message that
says "Action is Cancelled"... It doesn't allow me to put in my own message. I
can use vbdataerrcontinue, and the error message is not shown, but the record
is saved.


I think you need to trap the "Action is Cancelled" message in the Error event of
the datagrid, set the Error event's Response parameter to 0 (vbDataErrContinue),
and do your message there.
Jul 17 '05 #2
Steve...thanks

I've used the vbDataErrContinue and the message is suppressed. But the
record is still saved. I don't want it to save that record.

JP

"Steve Gerrard" <my********@comcast.net> wrote in message
news:7u********************@comcast.com...

"Joe-Paul" <Ha*********@comcast.net> wrote in message
news:1c********************@comcast.com...

If I put code in the Before_Update event checking for the required data
and the data isn't there, I can do "Cancel = true"...then I get a message
that says "Action is Cancelled"... It doesn't allow me to put in my own
message. I can use vbdataerrcontinue, and the error message is not shown,
but the record is saved.


I think you need to trap the "Action is Cancelled" message in the Error
event of the datagrid, set the Error event's Response parameter to 0
(vbDataErrContinue), and do your message there.

Jul 17 '05 #3

"Joe-Paul" <Ha*********@comcast.net> wrote in message
news:uv********************@comcast.com...
"Steve Gerrard" <my********@comcast.net> wrote in message
news:7u********************@comcast.com...

"Joe-Paul" <Ha*********@comcast.net> wrote in message
news:1c********************@comcast.com...

If I put code in the Before_Update event checking for the required data and
the data isn't there, I can do "Cancel = true"...then I get a message that
says "Action is Cancelled"... It doesn't allow me to put in my own message.
I can use vbdataerrcontinue, and the error message is not shown,
but the record is saved.

I think you need to trap the "Action is Cancelled" message in the Error event
of the datagrid, set the Error event's Response parameter to 0
(vbDataErrContinue), and do your message there.

I've used the vbDataErrContinue and the message is suppressed. But the record
is still saved. I don't want it to save that record.

JP

Don't use vbDataErrContinue in the BeforeUpdate event. Setting Cancel =
vbDataErrContinue is the same as Cancel = False, hence the record is saved.

Set Cancel = True. Then in the Error event, set Response = vbDataErrContinue.
Jul 17 '05 #4
Thanks Steve... It just takes a sledge hammer at times to get through my
thick skull...

It's now late...and I'll try it tomorrow.

Thanks Again,
JP
"Steve Gerrard" <my********@comcast.net> wrote in message
news:Nr********************@comcast.com...

"Joe-Paul" <Ha*********@comcast.net> wrote in message
news:uv********************@comcast.com...
"Steve Gerrard" <my********@comcast.net> wrote in message
news:7u********************@comcast.com...

"Joe-Paul" <Ha*********@comcast.net> wrote in message
news:1c********************@comcast.com...

If I put code in the Before_Update event checking for the required data
and the data isn't there, I can do "Cancel = true"...then I get a
message that says "Action is Cancelled"... It doesn't allow me to put
in my own message. I can use vbdataerrcontinue, and the error message
is not shown,
but the record is saved.

I think you need to trap the "Action is Cancelled" message in the Error
event of the datagrid, set the Error event's Response parameter to 0
(vbDataErrContinue), and do your message there.

I've used the vbDataErrContinue and the message is suppressed. But the
record is still saved. I don't want it to save that record.

JP

Don't use vbDataErrContinue in the BeforeUpdate event. Setting Cancel =
vbDataErrContinue is the same as Cancel = False, hence the record is
saved.

Set Cancel = True. Then in the Error event, set Response =
vbDataErrContinue.

Jul 17 '05 #5

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

Similar topics

0
by: johnson_cy | last post by:
I am using Access 2000. My main form has a record source of a table (employeeTbl with key of . It is filtering the record results. My subform and mainform have the link child/link master set...
8
by: Sue Bricker | last post by:
Hi, again. I have a piece of code behind a form that is producing the following error: "Too few parameters. Expected 1." However, it certainly looks like I have the parameters there. ...
4
by: Arif | last post by:
My programs searches the header of input barcode in index file. Get the record position next to Barcode header. Then moves the file pointer of products file to reach that record. My products...
19
by: LP | last post by:
I am using (trying to) CR version XI, cascading parameters feature works it asks user to enter params. But if page is resubmitted. It prompts for params again. I did set...
2
by: sara | last post by:
I think I don't understand combo boxes and forms - and all that I'm reading is just confusing me more. I am doing a "favor" for a non-profit organization. They take a phone call and need to...
6
by: dk4300 | last post by:
Hi!! I have a subform with a comments (memo) field, linked to a form. On the Memo field: Properties-Other-Enter Key Behavior = New Line in Field On the subform: Properties- Other- Cycle =...
7
by: bhrosey via AccessMonster.com | last post by:
I have a table that I use as a lookup reference on a form. The table includes the employee name and a yes/no field that gets checked whenever the employee leaves the company. Obviously I don't...
0
by: burttonboarder | last post by:
I'm working on a rails project where I have a table called people and a table called addresses. Each person can have many addresses. I've created a form which includes fields from both the People...
11
by: Jan | last post by:
Hi: Here's a problem I've had for a long time. The client is really running out of patience, and I have no answers. Access2003, front- and back-end. Single form with 4 subforms (each...
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
1
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.