×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Printing reports / Number field questions

Printing reports / Number field questions

Printing reports / Number field questions

(OP)
Two questions: (VFP 6)
A: If I choose "print report" fronm the application I have created, and choose "print current" it always prints the LAST one in teh table, not the one I've scrolled to (in a form wizard) how do I specify that the form shown in the one I want translate to the report?

2: This program is for a clinic with a network. How would I create a function to scan the field in the table for the highest number, check it against the variable, and if the variable is higher, permanently add 1 to it, and then use it in a field on a wizard-generated form? It's a multi-user program, and it's supposed to automatically assign patients a new patient #, but it has to be from a variable, and when the "ADD" button on the form is clicked, because it will be in use by more than one user. Any help is greatly appreciated. Thanks!!!! -Duffy

-Duffy W.,
chocklit@intrstar.net

RE: Printing reports / Number field questions

If I understand the question (#2), I whould do the following; create an index on the patient database, the key being the patient #. At the point that you are ready to write the record activate this index, goto bottom & add 1 to that patient id & write out the new record. Am I oversimplfying this or missing something?, let me know! The key is, not to generate the new patient # until, you are ready to write the new record.

RE: Printing reports / Number field questions

Do not full understand your question #1 but it sounds like when you created the report form, a database was added to the report form enviroment and the exact same enviroment does not exist when you want to print a record from the tables. Go into the report form and check the enviroment. Sounds like the report form is moving you to the bottom of the database. I, for one, hate the enviroment feature of the report form because it never seems to work consistently. I always clear the data enviroment and set the databases manually the way I want them and then call the report form. I do this because then I do not need 20 report forms to print info from one database, I only need one report form per index. If you turn the enviroment off try adding the record number or the patient Id to the report form call.

Report form xxxxx for recno() = PassedParameter
or
Report form xxxx for PatientId = AnotherTableIdField

To your Question Number 2 , I have a table of nextnumbs and a function I wrote to get the next number from the table. This way I can control Purchase order numbers that need to change each Month / Year. The table alway has one record in it and the field you call is always replaced with the next number to use. It also self maintains the Month and Year fields. The function cade and table struct follow.

*/***************************************************************************
*/Program : NextNumb
*/System : System Library
*/Purpose : Return the next number of the field requested
*/Syntax : string=nextnumb(field)
*/Returns : string
*/Parameter : field - string - name of the field to return the value of
*/Defaults : field= "ID"
*/Requires : database nextnumb
*/Changes : value of field
*/Calls :
*/Version : 1.0
*/Dated : 03/12/94
*/Written By: David W. Grewe
*/***************************************************************************
*& type of prg :
*/***************************************************************************
*/ Record Of Change
*/
*/***************************************************************************
parameter pcField
if empty(pcField) or type("pcField")#"C"
pcField="ID"
endif
*
lcAlias = alias()
if used("NEXTNUMB")
select NEXTNUMB
else
=dbfopen(fcSysDbf+"NEXTNUMB","NEXTNUMB")
endif
*
* lock the database so noone else can have the same number
*
do while !rlock()
wait "Failed to lock the Next Number Database, Waiting 1 second" window timeout 1
wait clear
enddo
*
* check the database month in case the numbers need reset.
*
if month(date()) != NEXTNUMB.MONTH
replace NEXTNUMB.MONTH with month(date())
replace NEXTNUMB.ORDER with 1
endif
*
* check the database Year in case the numbers need reset.
*
if year(date()) != NEXTNUMB.YEAR
replace NEXTNUMB.YEAR with year(date())
replace NEXTNUMB.INVOICE with 1
endif
*
* get the next number
*
lnNextNumb = (NEXTNUMB.&pcField)
replace NEXTNUMB.&pcField with lnNextNumb + 1
unlock in NEXTNUMB
*
if !empty(lcAlias)
select (lcAlias)
endif

return lnNextNumb



Structure for table: D:\BIDSYS\DBF\NEXTNUMB.DBF
Number of data records: 1
Date of last update: 02/10/00
Code Page: 1252
Field Field Name Type Width Dec
1 ID Numeric 10 0
2 INVOICE Numeric 10 0
3 ORDER Numeric 10 0
4 PURCHASE Numeric 10 0
5 YEAR Numeric 4 0
6 MONTH Numeric 2 0

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close