Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parameterized view not working when called from a form
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00059403
Message ID:
00059621
Views:
29
>>>I'm trying to run a report from a form for a single record. I've created a parameterized view and when I run it from a test program It works fine, but when I run it from my form it does not work, it pulls up 0 records in .03 seconds. The variables have valid data and in theroy it should pull up find one record.
>>>
>>>I'm new to fairly new Visual Foxpro and any help would be greatly appreciated.
>>>
>>>Here is code for the print (click) event:
>>>PRIVATE lnCheckNum, lnInt_Id
>>>SELECT checks
>>>TABLEUPDATE()
>>>* Get and increment Checknumber
>>>SELECT accounts
>>>lnCheckNum = accounts.NextCkNum
>>>REPLACE accounts.NextCkNum WITH accounts.NextCkNum + 1
>>>SELECT checks
>>>REPLACE checknum WITH lnCheckNum
>>>REPLACE int_id WITH accounts.int_id
>>>lnInt_Id = accounts.int_id
>>>* lvPrnCheck View uses lnCheckNum and lnInt_Id as parameters
>>>REPORT FORM MicrCheck PREVIEW
>>>thisform.release()
>>>
>>>Here is the SQL code created for the parameterized view:
>>>SELECT Accounts.name, Accounts.add1, Accounts.add2, Accounts.add3,;
>>> Accounts.add4, Accounts.phone, Accounts.acctnum, Accounts.routingnum,;
>>> Accounts.fraction1, Accounts.fraction2, Accounts.bankname,;
>>> Accounts.bankaddrr, Accounts.bankcsz, Accounts.siglines2,;
>>> Accounts.sigmessage, Accounts.logofile, Accounts.sigfile,;
>>> Accounts.int_id, Checks.payee1, Checks.payee2, Checks.payee3,;
>>> Checks.payee4, Checks.checknum, Checks.amount, Checks.date, Checks.memo;
>>> FROM micrchk!accounts INNER JOIN micrchk!checks ;
>>> ON Accounts.int_id = Checks.int_id;
>>> WHERE Checks.int_id = ?lnInt_id;
>>> AND Checks.checknum = ?lnChecknum
>>
>>Hi Marvin,
>>
>>I don't see any problems with your code, so they problem may be with the report and how it calls the view. Here are several things to check:
>>
>>1. Is the view in your report data environment?
>>2. Does the report have a private datasession?
>>
>>If either 1 or 2 is yes, then remove the view from the report DE and set the report to DEFAULT. Update the data in the view in the code of the click button with a requery() (I'm assuming the view is in the form's DE. If not, then USE the view.) Then run your report preview.
>>
>>Reports are a little tricky sometimes in how they handle data.
>>
>>HTH
>>Barbara
>
>Another solution to this, if the form functions only as an option screen for the report, is to leave the view in the DE of the report and to DO the form in the .BeforeOpenTables method of the DE returning the parameters for the view from the form.

Good idea, Colin, and similar to what I generally do. It keeps everything in one place. However, in Marvin's case lets get his bugs out before we start him on new techniques :-)

Barbara
Barbara Paltiel, Paltiel Inc.
Previous
Reply
Map
View

Click here to load this message in the networking platform