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!

How do I create a parameter in a query to print one record 1

Status
Not open for further replies.

bborel

Technical User
Jan 20, 2004
16
0
0
US
I am very new to FoxPro and have used Access for years. In Access you can put a parameter in a query field so the user will be prompted to provide for example - an account number, then the report - which is based on the query - will only print that one record. I am lost in FoxPro....and I'm not sure how to use the "command" window..Please help if you can....Bss
 
hi
in foxpro you done this on two lines

AccNo = inputbox("Enter Account No")

REPORT FORM MyReport PREVIEW FOR MyACcNo = AccNo

write down this code in a pRG or Command Window

 
hyderzaman1 - help again...

okay let's put this in kindergarten terms....when i put this in the little command window - i don't know what to do next. you gave me 2 lines to enter..

AccNo=inputbox("Enter Account No") - where does this go....
-JobNo-is the true name of the field i want to use....and the report name is jobrelease. so it would go like this?

JobNo = inputbox ("Enter Job No")

and the next line u gave me was..

REPORT FORM MyReport PREVIEW FOR MyACcNo = AccNo

REPORT FORM jobrelease PREVIEW FOR ????? = JobNo ???and then please draw me a picture of how to put this in my query..thanks again,ms.bss
 
Judging by your inexperience with Foxpro ...

I would suggest you purchase a book or two about Visual foxpro and use that to get started.

Just getting a tidbit here and there on Tek-Tips is not going to get you anywhere. (In my opinion ...)



Don


 
O K Again

AccNo = inputbox("Enter Account No")
Here AccNo is a memory variable

MJobNo = inputbox ("Enter Job No")
REPORT FORM jobrelease PREVIEW FOR JobNo= MJobNo

Or You Can Write A PRoGram And Run IT

Type In Command Window
Modify Commands REP ( For Opening PRG)

** Write These Two Line In Rep.PRG Window
MJobNo = inputbox ("Enter Job No")
REPORT FORM jobrelease PREVIEW FOR JobNo= MJobNo

**And Now Save This File And ComeBack To Command Window

And Type In Command Window
DO REP


 
Bborel,

Since you used the term 'query', am I right in saying that you feel comfortable writing an SQL Select statement to produce a result set, which you can then use as the input to a report?

If so, your code should look something like this. (I'm assuming you have been able to create the report in the repot designer).

lnAcct = 'ABC100' && this is actual account number
SELECT * FROM AccountTable WHERE AccountTable.AccountNumber = lnAcct INTO CURSOR TempCursor
&& TempCursor is a cursor which will hold the result set
SELECT TempCursor && switch to the cursor's work area
REPORT FORM MyReport PREVIEW && do the report

You write this code in a PRG file (to create a PRG file, type MODIFY COMMAND in the command window). Then, save the PRG file, and run it by typing DO followed by the name of the PRG; do that in the command window.

The point that hyderzaman1 addressed was how to actually get the account number from the user. That was what the INPUTBOX() was for, although there are other ways of achieving the same goal.

Hope this helps.

Mike




Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top