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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INKEY: Function argument value, type, or count is invalid

Status
Not open for further replies.

chpicker

Programmer
Apr 10, 2001
1,316
My error log occasionally comes up with this error. It happens maybe once a week or so. It claims to be happening on line 32 of my browsetable.prg file. Here is the line:
[tt]
nKeyPress=INKEY(0,'H')
[/tt]
The error doesn't make any sense to me. I'm passing 2 literal constants to the INKEY() function. This error, if being reported correctly, should occur EVERY time the code runs, not just once a week.

The browsetable function is a generic function used throughout my program for data entry and data lookup forms. It allows a user to search for a field in a grid, and is called by the KEYPRESS event of the grid's textbox. I have declared nKeyPress to be a LOCAL variable, so it can't interfere with any pre-existing variable of that name.

Has anyone else ever seen anything like this? Is there something I'm missing that could cause the line to generate this error? Or is the error being reported incorrectly and something else is going on? Any insight?

Thanks,

Ian
 
Ian,

I have never used the second parameter!

This is probably something else, try dropping the
second parameter in the short term though?

HTH

Regards

Griff
Keep [Smile]ing
 
Hey Griff,

The second parameter is used to hide the blinking cursor that normally appears while waiting for a key to be pressed. I suppose I could change the single line to this:
[tt]
nKeyPress=0
DO WHILE nKeyPress=0
DOEVENTS
nKeyPress=INKEY()
ENDDO
[/tt]
This seems kinda cumbersome, though, and needlessly complex. In any case, the line I AM using works properly 99% of the time.

*boggles*

Ian
 
Ian,

I looked in the help to find the 'Hide' parameter...

I would probably not want to put that loop in if I could help it.

Why not try living with the cursor for a few days? Just to see if it, the problem, goes away?


HTH Regards

Griff
Keep [Smile]ing
 
Well, I can try it. Nothing to lose, of course.

Any other suggestions?

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top