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

Report on current record

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Simple question i think:

I need to do report based on data from the table, just simply print all fields for the current record.

I have a form where user enters data or chooses from already entered records. Then he clicks a button and there should be report with info on this record.

However, my report always shows me the first record in db.

How to make report based on current record (or any other defined record) ?

Thanks
 
I think Lance did an FAQ on this, but you just need to grab the key value(s) for the record being displayed, query for just that record using the key value(s), then print the report based on the answer table (which should only contain the record you want).

Mac :)

"Do not delve too deeply in the arts of your enemy and so become ensnared by them"

langley_mckelvy@cd4.co.harris.tx.us
 
v_v_v

Below is an approach that uses SQL. I had attached it to the double click event of the Ref field on my form (Ref was my unique identifier or key value) I was actually using the code for the purposes of drilling down into records on the form so I have adjused the code slightly in order to help achieve what I think you want to do.

The SQL statement 'Selects All' from the table where the key is the same as the value of Ref of your current record. When executed the SQL statement writes the captured values to an answer table. Your report can then output the contents of the answer table.

The advantage of the Select * (Select All) statement is that no matter how many extra fields might be added to the table at a later date they will always be captured in your answer.


Regards

Bystander

PS please be wary, the punctuation needed to write SQL directly into ObjectPal can sometimes be a real irritant.

____________________________________________________________
method mouseDouble(var eventInfo MouseEvent)
Var
SqlVar SQL
sTilde String
s string
t string
db database
RPT Report
EndVar

db.open (":Work:")
sTilde = self.value
t ="YourTable.Db"
s = "select *" +
"from '"+t+"'"+
" where Ref ='" + sTilde + "'"

sqlVar.readFromString(s)
sqlVar.executeSQL(db,":priv:__YourPrivateTable.Db")
;place your code for printing your report here
endMethod
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top