5 Replies - 1972 Views - Last Post: 14 May 2012 - 04:30 AM Rate Topic: -----

#1 mjbonganay06  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 11-May 12

Program Error in Visual FoxPro. "too few arguments"

Posted 11 May 2012 - 09:15 PM

sele 2
	a=Badgeno
	b=Date
	c=slot
	L=substr(TTOC(datetime))
	?L
	Skip
sele 1
Locate for Badgeno = a and Date = b
	If c="1"
		Replace in1 with L
	Else If c="2"
		Replace out1 with L
	Else If c="3"
		Replace in2 with L
	Else If c="4"
		Replace out2 with L
	ENDIF



That was the code i used.
everytime i run the program an error appears to L=substr(TTOC(datetime)) that tells me "too few arguments"
please help me. thanks.

This post has been edited by GunnerInc: 15 May 2012 - 04:05 PM
Reason for edit:: Added code tags


Is This A Good Question/Topic? 0
  • +

Replies To: Program Error in Visual FoxPro. "too few arguments"

#2 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5677
  • View blog
  • Posts: 12,211
  • Joined: 02-June 10

Re: Program Error in Visual FoxPro. "too few arguments"

Posted 11 May 2012 - 09:19 PM

Look up in the documentation how to use the function: stop guessing.
It should show you what and how many parameters its expecting.

I'm guessing substr means Substring... and you're giving it one parameter which I hope is a string. ... But don't you need to give it numbers also, so it knows which letter to start on and for what length? That's what most substring methods do in most languages.

UPDATE:

Did a Google for "foxpro substr" and clicked the first link:
http://msdn.microsof...1(v=vs.71).aspx

Which shows you how to use it. And sure enough it wants at least the starting position with an optional length.

SUBSTR(cExpression, nStartPosition [, nCharactersReturned])



Finding answers to specific problems:[spoiler]
Sometimes just knowing where to look can make all the difference. Google is your friend.
Search with either "C#" or "MSDN" as the first word: "MSDN Picturebox", "C# Custom Events", "MSDN timer" etc.
How to do a good search that will get you targeted answers.

This post has been edited by tlhIn`toq: 11 May 2012 - 09:20 PM

Was This Post Helpful? 1
  • +
  • -

#3 mjbonganay06  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 11-May 12

Re: Program Error in Visual FoxPro. "too few arguments"

Posted 12 May 2012 - 04:14 AM

I got it but another error appears.
it says:
function name is missing )
i'm really confused right now.
Was This Post Helpful? 0
  • +
  • -

#4 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5677
  • View blog
  • Posts: 12,211
  • Joined: 02-June 10

Re: Program Error in Visual FoxPro. "too few arguments"

Posted 12 May 2012 - 08:56 AM

Lets see your new code
Was This Post Helpful? 0
  • +
  • -

#5 mjbonganay06  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 11-May 12

Re: Program Error in Visual FoxPro. "too few arguments"

Posted 13 May 2012 - 09:05 PM

sele 1
	a=Badgeno
	b=Date
	c=Slot
	L=substr(TTOC 10,5 (datetime))
	?L
	Skip
sele 2
Locate for Badgeno = a and Date = b
	If c="1"
		Replace in1 with L
	Else If c="2"
		Replace out1 with L
	Else If c="3"
		Replace in2 with L
	Else If c="4"
		Replace out2 with L
	ENDIF

This post has been edited by GunnerInc: 15 May 2012 - 04:05 PM
Reason for edit:: Added code tags *** Please use code tags! ***

Was This Post Helpful? 0
  • +
  • -

#6 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5677
  • View blog
  • Posts: 12,211
  • Joined: 02-June 10

Re: Program Error in Visual FoxPro. "too few arguments"

Posted 14 May 2012 - 04:30 AM

I don't do foxpro, but even I can see this is not correct syntax.

Are you just guessing at how to do this?

Look at how you formed this line, then look on the MSDN page I linked to you, at how it is supposed to be formed.

L=substr(TTOC 10,5 (datetime))

SUBSTR(mystring, 6)

TTOC 10 and 5(datetime) cannot in any way be correctly formed paramenters.

Perhaps you should pick up a book or find some beginner tutorials on FoxPro coding before you start trying to write a program from scratch. You can't just guess at syntax.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1