I've read the FAQ regarding printing the currrent record from a form....but

I've read the FAQ regarding printing the currrent record from a form....but

Post by Virginia Harlo » Thu, 15 Apr 1999 04:00:00



my form ties a master table, unified.db to 7 other tables by the id#.  Thats
8 total tables.  I have created a report based on an answer table, and the
code follows:

        var
         q   query
           rpt Report
           num String

        endVar

        num=String(ID#)
        q=Query

        Query
        ANSWER: :WORK:answer.db

        unified.DB | ID#        | FullName | LName  | FName  | MI     |
Prefix | Suffix |
                   | Check ~num  | Check    | Check  | Check  | Check  |
Check  | Check  |

        unified.DB | Title  | Company | Address1 | City/State | Zip    |
Country |
                   | Check  | Check   | Check    | Check      | Check  |
Check   |

        unified.DB | PrimaryAgent | Phone  | Fax    | AltPhone |
ActiveClient? |
                   | Check        | Check  | Check  | Check    | Check
|

        unified.DB | IUQ?   | ActiveBusClient? | BusTaxID | DOB    | Smoker?
|
                   | Check  | Check            | Check    | Check  | Check
|

        unified.DB | MaritalStatus? | Sal    | Spouse | SS#    | SpouseSS# |
                   | Check          | Check  | Check  | Check  | Check     |

        unified.DB | SpouseDOB | SpouseOcc | SpBusPhone | Dependents |
DependentsSS# |
                   | Check     | Check     | Check      | Check      | Check
|

        unified.DB | DependentsDOB | AltContact | ReviewMonth | BadAddress?
|
                   | Check         | Check      | Check       | Check
|

        unified.DB | Selection | Notes  | ECName | Pol#   |
                   | Check     | Check  | Check  | Check  |

        EndQuery

        if not executeQBE(q) then
         errorShow("Could not execute Query")
           Return
        endif

        if not rpt.open("clientreport1.sl") then
         errorShow("Could not open report")
           return
        endif

        endMethod

I get an error message because it won't run the QBE because it says it's
expecting
| in the table header, but when I look, they are all there.  What gives?

The alternative method below using tcget, tcput:
the code is:

        var
         tcget,tcput   TCursor
         rprt     Report

        endVar

            if not tcget.attach(ID#) then
            errorShow()

           endif

           if not tcput.open("holdadd.db") then
            errorShow()

           endif

           if not tcput.isEmpty() then
            tcput.Empty()
           endif

           tcput.edit()
           tcput.insertRecord(tcget)
           tcput.postRecord()
           rprt.open("clientrecord1.rsl")

        endMethod

and when I try this, the info from the master table shows, but none of the
detail stuff in the detail tables at all, as they are all tied to the
unified table, not the holdadd.db table, or at least that is what I'm
thinking.

What am I doing wrong?

 
 
 

I've read the FAQ regarding printing the currrent record from a form....but

Post by Bob Stub » Fri, 16 Apr 1999 04:00:00


*ia:

Another thing I've found to be useful with this type of error is to
save the query that is formed and look at it in native paradox or, if
native paradox can't open it, open a text editor - like notepad - and
open it that way.  I was going crazy with that type of problem once
and found that I had used a "tab" rather than a "space" character in a
field name and it wasn't obvious within the code.  Anyway, to do this,
form your query but before the execute, add
"q.writeQBE("whatever.qbe")".

HTH.

Bob

 
 
 

1. "I've read the FAQ on printing the current record from a form...but"

Here we go again....

Kasey, I've tried changing the field names which created a mess....and have
given up on the query idea of linking these 7 tables to the master and
getting all of it in a "clientrecord" report.  I need to do this somehow,
but no matter what I try, I might get the master table information, and none
of the tied tables show any data at all.

This is what I'm trying now:

method pushButton(var eventInfo Event)
var
clientTC, oneclientTC   TCursor
rpt   Report
endvar

;open tcursors for each table
if not clientTC.open("unified.db") then
 errorShow("Could not open table Unified.db")
   return
endif

;if in a network environment use the folloiwng line:
if not oneclientTC.open(":work:holdall.db") then
 errorShow("Could not open table holdall.db")
   return
endif

;locate the current client number in the unified table
if not clientTC.locate("ID#",ID#) then
 errorShow("Unable to locate client")
   return
endif

;put holdall into edit mode
if not oneclientTC.edit() then
 errorShow("Could not open holdall table for editing")
   return
endif

;empty the holdall table
if not oneclientTC.empty() then
 errorShow ("unable to empty table")
   return
endif

;prepare to insert the current record into this table
if not oneclientTC.insertRecord() then
 Errorshow("could not insert record")
   return
endif

;copy current record from unified.db
if not oneclientTC.copyRecord(clientTC) then
 errorShow("Unable to copy record")
   return
endif

;take table out of edit mode
if not oneclientTC.endedit() then
 errorshow("could not end edit")
   return
endif

;close the table
if not oneclientTC.close() then
 errorshow ("could not close table")
   return
endif

;open report
if not rpt.open("clientrecord1.rsl") then
 errorShow("Could not open report")
   return
endif

endMethod

This gets as far as the point where it says to me "cannot copy record,
insufficient field rights, ID#" and this makes no sense to me as the table
holdall does contain the info from the master record.  If I then try to run
the report manually none of the tables are tied and none of the additional
data links.  I created an additional field in all of the linking tables
especially to link to the holdall table, and the data model has the right
linking information, but it doesn't work anyway.

When I go through my database, and want to view the totality of info on any
given client, I cannot do it and print it.  ARRGH!

What am I doing wrong here?

I only get to try this stuff in spare time...blasted it, and there isn't
enough of that.
There was a point when I had a report that would link EVERY client with all
of their extra tables, but it won't work for just one from a pushbutton.

2. VA-VA-Vienna-112052--ORACLE-SYBASE-Test Analyst, COMPUS

3. SQLMail - I've read the KB but I'm still stuck

4. RDS doesn't work - Unexpected Error

5. I've read the FAQ regarding BDE config but..

6. Keyword search

7. Can't update records I've created

8. Help with continuous error.

9. I've followed the faq and still getting too many clients errr

10. ATTN: SQL Service Manager -- if you've had issues, please read

11. (PDW 5.0) Make one form's selection to open 2nd form to desired record

12. How to force print 'Current Record' and print 'Records Being Browsed'