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 to set up multiple forms for one database

Status
Not open for further replies.

stanger1

Technical User
Apr 8, 2002
18
0
0
US
I have hit a road block with a database that I am putting together. The problem is that I have one database that I need to have certain fields entered in multiple times. Example: I have a form that I enter a particular sales record based on receipt number, but I need to keep entering more records to the same fields under that receipt number. I was looking at using subforms to add additional information under that particular receipt. Am I heading in the right direction? I would like to have the receipt number field keep the information until I am finished with the receipt. I am running Approach 9.5 Any help on this matter would be greatly appreciated.
 
Hi,

I think you are going straight into the wrong direction. Your problem could not be solved with additional subforms. First you have to define the structure of your database.

If you you want to build a database which should contain the data of your receipt, you have to look what kind of data you have to work with.
First you have a header with the receipt number, the date, the customer name etc.
Second you have entries with the position data like the article Name, article number, quantity, price etc. These are the fields you have to fill in for each receipt item. Therefore your database should be build of two database tables.

1. ReceiptHeader.dbf with the fields ReceiptNumber, ReceiptDate,CustomerName etc.
2. ReceiptItem.dbf with the fields ReceiptNumberItem, ArticleName, ArticleNumber, quantity, price etc.

Now build a new APR file named Receipt.apr and create a form which contains the fields from the ReceiptHeader.dbf. Next go to Create, Join. You will see the database ReceiptHeader.dbf. Via the OPEN dialog open the ReceiptItem.dbf. Now you will see the ReceiptHeader and the ReceiptItem .dbf's in the Join window. Left click the ReceiptNumber field in the ReceiptHeader table, hold the mouse button, drag the cursor to the ReceiptNumber field of the ReceiptItem table and loose the mouse button. There should now be a connectin line between the to database tables. Next click right on the connection line between both tables and select the OPTIONS button.
Set a mark into the insert checkbox beside 'If no records match the "RECEIPTHEADER" record, typing into a blank "RECEIPTITEM" field inserts an new record. Close the Join dialog with ok.
Now you have to database tables which are joined via the ReceiptNumber field.
Next you add a repeating panel to your prior generated form (the form thats already containing the ReceiptHeader fields) and put the ReceiptItem fields into it.

Now you have a form which contains the header data of your receipt and a repeating panel which could contain 1 to n item records. Every time you click into an empty field of the repeating panel, a new record with the RecordNumber will be generated.

If this works, you should do some cosmetics. You should set the ReceiptNumber field in the repeating panel to 'read only' and change the definition of the ReceiptNumber field in the ReceiptHeader.dbf to unique. Additional you could set the ReceiptNumber field to a default value 'serial number'.

Hope that works.

Lu
 
Thank You for your help! Your response was very helpful!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top