Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to stop CTRL 0 giving .NULL. 1

Status
Not open for further replies.

vinemicros

Programmer
Apr 4, 2001
12
GB
How do I stop CTRL 0 giving .NULL. as this is making my program crash - since most fields don't like .NULL. as an input?

(I have a member of staff who accidentally does CTRL 0 instead of SHIFT 0 to create an end-of-brackets character.)
 
Try this in the beginning of your app or INIT event of your form:

ON KEY LABEL CTRL+0 *

It will make it so that nothing happens when the key combination is pressed.

Dave S.
 
Just to clafiry the problem I had:

A user was adding a new record in my database, and one of the first fields to fill in was a text-box.

The user would type some text, but being a bit too quick on the keyboard would accidentally type CTRL-0 rather than SHIFT-0 in order to get the end bracket ')'.

By default, CTRL-0 creates the '.NULL.' value in the field, which my program did not like one bit, and it crashed.

Dave's solution told Foxpro to effectively ignore CTRL-0, and thus the problem is gone.
 
The reason for the program crash is that you created the table to not allow NULL values in that field. This is the default setting, I believe, so it's not something you did intentionally.

I must be lucky...no one has ever done this with my app in the 2 years I've been maintaining it. I found that it DOES, in fact, crash my app, but I guess none of my users have ever hit CTRL+0. :eek:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top