PDA

View Full Version : Problem with New Record Rows


ABC123

Steve Wood
07-31-2004, 09:42 AM
I can't seem to provide ability for user to both Update an existing record, or Insert a new record. Two scenerios with different new record row values. Assume this a Customer table with only one record per customer:

Allow Update = Checked
Allow Insert = Checked
Number of new record Rows = 0
---
If record exists, displays a single record for update
If record does not exist, no form appears, just the nav bar with Update button.
---
Number of new record Rows = 1
---
If record exists, displays record plus one blank record
If record does not exist, displays one blank record for insert.


In the 1st scenerio, I get an appropriate single record to upate an existing customer, but cannot insert a new customer record.

In the 2nd scenerio, I get an unwanted second blank record for the existing Customer, but get a proper single (blank) record to add the missing Customer.

forskare
07-31-2004, 12:36 PM
Steve,

Assuming I understand your setup, a single table can only update the existing data in a field. You cannot have a browse to show customer data using only one table.

If you want each customer to have multiple invoices, for example, you will need to add a child table. Then you can add the browse and add records via a new row. Otherwise, I see no value in a browse on a form to show the customer other than to show the customer's names.

kenn

forskare
07-31-2004, 12:39 PM
Steve,

My mistake. I'm sittinf in the filtered sun on my deck in the back yard and didn't realize I had chosen the wrong forum. So, I might be all wet or I might be right.

kenn

Selwyn Rabins
08-02-2004, 07:02 AM
steve

i am having a hard time understanding the question.
there is sufficient flexibility in the Grid component, and in the ability to set properties of the Grid at runtime using xbasic, that any scenario should be doable.

i was confused by this:
Allow Update = Checked
Allow Insert = Checked
Number of new record Rows = 0

if you allow insert, then the number of new record rows should be greater than 0.

can you describe simply what you want to happen, and i will show you how to get it done.

Steve Wood
08-02-2004, 08:16 AM
Thank you Selwyn; I have rethought the program, and no longer have the problem.

I was filtering a table to show a single record, unique by a CUST_ID that was entered by the user at runtime via a Login. If they entered a non-existing ID then Insert produced the problem I described.

In retrospect, my method was silly; I was using Insert incorrectly. Now, if they enter a non-existing ID, I go through an Add New User script to add them as a new user to the Customer table.

Note: I had two tables, one for User_Names (with password) and a second for Customers. So a CUST_ID could be authenticated in the first, but not be present in the second. So I eliminated the User_Name table and authenticate directly aginst the Customer table. Now the situation in paragraph one above can no longer exist.

Robert Emery
09-02-2004, 09:09 AM
"if you allow insert, then the number of new record rows should be greater than 0."

My $.02 on that, then , is that the program should not allow 0 if allow insert is checked. Might eliminate some confusion during the learning process.

All in all, I'm finding it (WAS) a bit steeper learning curve than expected, but worth the effort.

Thanks,
Bob Emery