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

Function arguement value error

Status
Not open for further replies.

oakpark5

Programmer
Sep 2, 2004
81
0
0
US
I keep getting an error:
Function arguemnt value,type,or value is invlaid.

This program is developed in FoxPro5, now the program runs fine when i run it in foxpro but when i attatch it to another program that calls it,...I get that error, that doesnt make sence to me. I'm a C#.net programmer so this whole foxpro thing is kinda strange...

The program is using two bblistviews that when a user double clicks on an item on the first one it will display more detailed info on the bottom one. Thanks for the help in advance...

Software Engineer
Team Lead
damn bill gates, he has everything
 
Oakpark5,

Run your application from within the VFP development environment. Before you start, open the Debugger (from the Tools menu).

Next time the error comes up, click on the Suspend button. Go to the Trace window in the Debugger and note which line the little yellow arrow is pointing to.

Let us know exactly what that line says, as close as possible. It would also be helpful if you could check the values of any variables or fields that you can see within the line. One way to do that is to rest you mouse on each item in turn and read the value from the resulting tooltip.

I know VFP seems weird compared to C#, but basically it's not that different from most other languages. Concepts like functions, arguments, variables, etc, are the same as elsewhere.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Are you calling the program from another VFP app. Does your VFP5 app have a LPARAMETERS or PARAMETERS statement at it's start? Could you post the line of code that is generating the error?

Regards,

Mike
 
Mike, I was born in Edinburgh.....how is Scotland treating an Englishman. LOL. Alright, well the foxpro app that is calling the form I'm working on is in foxpro5....it gives that error. I ran the debugger and it gave me no errors, when i run it in the foxpro ide I dont get any errors, only when I run it in the other app. Now I commented out the refresh for the second bblistview and it works, of course it doesnt display anything in the second one. Only when I try to display data in the second one does it give me an error.

if type('la_filters') <> "C"
return
endif
for ln_temp = 1 to alen(la_filters,1)
if alltrim(la_filters[ln_temp,2]) = alltrim(lc_plinid)
lc_filter = la_filters[ln_temp,1]
exit
endif
next
create cursor a_tmpf4 (item c(15), itmdesc c(60), units2003 n(10), ytd2003 n(10), units2004 n(10), ytd2004 n(10), units2005 n(10), ytd2005 n(10))
index on item tag order1
select a_tmpf1
goto top
do while !eof()
if &lc_filter
select a_tmpf4
seek alltrim(a_tmpf1.item)
if !found()
insert into a_tmpf4 (item, itmdesc) values (a_tmpf1.item, a_tmpf1.itmdesc)
endif

Software Engineer
Team Lead
damn bill gates, he has everything
 
OH, and why cant I call functions on a form? Annoying...

Software Engineer
Team Lead
damn bill gates, he has everything
 
In fact you can call functions from forms. You can also "call" methods of objects from forms.

You can get the error you are describing if the underlying data source is a different type in one table than another. (It's not obvious from your information if you are always using the same data.) Also, it may be necessary to check if there is any data actually in your data source - many controls act badly if there isn't any data.

Rick
 
Adding this to the first line seemed to fix the problem:
or empty(lc_plinid)

I'm not to happy with the speed of the programe either. I'm connecting to a SQL server, does foxpro5 support ADO and can it call sql stored procedures? Do you think this would help the speed of the program?

Software Engineer
Team Lead
damn bill gates, he has everything
 
Speed of the program?? Foxpro is very, very fast for virtually any data operation.

Yes it supports all of these but I doubt that is going to fix any speed issue. When is it "slow"?

Most of the time a complaint of slow processing is caused by recursive refresh calls, unoptimized selects, and numerous other issues with coding.

Perhaps you can post more info...


Don Higgins
Crew Chief Pro Racing Analysis Software
 
Oakpark,

, I was born in Edinburgh.....how is Scotland treating an Englishman

Well, I've been here so long that I sometimes forget I'm a foreigner. Of course, once I open my mouth to speak, that's another matter.

I'm not to happy with the speed of the programe either.

It's not possible to tell from the fragment of code that you have supplied why it is running slowly. As Don rightly says, FoxPro is inherently very fast, but there are many things that can slow it down.

I'm connecting to a SQL server, does foxpro5 support ADO and can it call sql stored procedures? Do you think this would help the speed of the program?

Yes, yes and no. The code you posted does not address a back-end in any way. It is working with native cursors, so I can't see how SQL Server fits into the picture.

VFP does support ADO, but there are much simpler ways of accessing back-end data. Then again, if you are comfortable using ADO, there's no reason not to go for it. Stored procedures are also supported.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
I pasted into VFP8 and applied beautify.
Code:
If Type('la_filters') <> "C"
	Return
Endif

For ln_temp = 1 To Alen(la_filters,1)
	If Alltrim(la_filters[ln_temp,2]) = Alltrim(lc_plinid)
		lc_filter = la_filters[ln_temp,1]
		EXIT
	Endif
NEXT

Create Cursor a_tmpf4 (Item c(15), ;
			  itmdesc c(60), ;
			  units2003 N(10), ;
			  ytd2003 N(10), ;
			  units2004 N(10), ;
			  ytd2004 N(10), ;
			  units2005 N(10), ;
			  ytd2005 N(10))
			  
Index On Item Tag order1
Select a_tmpf1
Goto Top
Do While !Eof()
	If &lc_filter
		Select a_tmpf4
		Seek Alltrim(a_tmpf1.Item)
		If !Found()
			Insert Into a_tmpf4 (Item, itmdesc) ;
				Values (a_tmpf1.Item, a_tmpf1.itmdesc)
		Endif

* We seem to be missing a ENDIF and ENDDO
* And probably SELECT a_tempf1 and SKIP as well - paste error?

Instead of using GO TOP AND DO WHILE I would use SCAN ENDSCAN. It keeps track of the workarea for you and starts from the top. Probably be faster also.

Regards,

Mike
 
Well thanks for the help everyone, I finished the program...and no offense but this was the first and most likely the last time I'm going to use FoxPro, I'll stick with C# and Java.....

Software Engineer
Team Lead
damn bill gates, he has everything
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top