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

best strategy for adding new customer 1

Status
Not open for further replies.

Judi201

Technical User
Jul 2, 2005
315
US
Hi!

I am completely rewriting an old DOS FP aplication using VFP 6.0. I am trying to use new ways of doing things and would like some comments on the 'best way' to do the following:

I have a pageframe (I really like the look of these) with 6 tabs. The first page displays customer info ('Bill To' 'Ship To') and such as YTD, payment terms, ship via, etc.) I am thinking other tabs will show Invoicing, Job Status, Inventory, etc.

I am wondering about the best way to enter new customer info. I think I would like to just use the screen layout that displays the info on the page and have buttons for 'Add' 'Edit' 'Save' and maybe 'Cancel' visible.

In 'olden days' [smile] I would have APPENDed BLANK, SCATTERed, processed and GATHERed. I know this is still available but I am wondering if another approach might be better such as using views or cursors in some way. I have read a lot on the subject but I seem to always need a very simple start and then I can adjust and get going. I don't think I am ready in understanding to abandon tables and use all views or whatever but am confortable with SQL SELECTs

I would appreciate any suggestions for an approach that is current and 'somewhat standard' allowing for developer preferences.

Thanks for all

Judi
 

Hi Judi,

Although you can use the SCATTER / GATTHER approach if you wish, the preferred method is to use buffered tables.

Essentially, you need to make sure that your customer table is buffered (either via CURSORSETPROP() or by setting the form's Buffermode property).

Next, make sure that the customer fields in your form are bound to the corresponding fields in the customer table (so, the ControlSource of the Address field would be customer.address, for example).

You will need, as a minimum, a Save button and a Cancel button on the form. The Save button will execute a TableUpdate(), and the Cancel will execute a TableRevert() plus a Refresh.

Forget about views as far as this is concerned. (Views are useful in many circumstances, but they are not directly related to your question).

When you run the form, the user will be able to edit the customer fields in the usual way, but the edits will be stored in a buffer. When you execute TableUpdate(), the edits will be comitted to the file. TableRevert() cancels the edits and puts the buffer back where it was.

The above is very much a simplification, but it should point you in the right direction. Read the help topics on buffering, and come back if anything needs clarifying.

By the way, I see you haven't been around here for a few days. I know you are in Alabama. I hope you were not affected by the events on the Gulf Coast last week.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Mike,

I am back at home now after being gone since Tuesday morning when we were able to get out. Our power was restored last night and we are back on cable (my son is in charge of the cable in this area so that helped)[smile] We had only minimal property damage and our problems are small compared to so many. Thank you for asking.

Your response was what I thought but as you have seen I always need a kick in the right direction to get me started. I have taught myself to do things all my life by reading. I don't understand why this is proving so hard. My grandsom says it is because I want to recreate the wheel instead of going along for the ride! I guess he is right. I try to focus on using what is available but there is so much and and I seem to have no intuitive 'feel' for which way to go.

So I read HELP and my books on 'buffering' and will use that. I read that MULTILOCKS ON must be issued. I will use the form's Buffermode property; but, as I try to think this thru, I am puzzled. The form I have currently displays the info for the first customer on loading. I was thinking of a button 'Add' which will clear all fields and await entry. I don't know how to do this other than some long coding. What do you suggest or should I have a separate form for data entry (I really don't want to unless there in a strong reason for it)

I want to thank you for getting me started on classes! I had completed my navigation bar (it is snazzy with disabled buttons at proper times and such)) and completed a couple of special buttons before I finally saw the light through the fog and then I could not believe how simple and wonderful it is. So I spent my time in seclusion making classes and I am sold on this concept.

Many thanks for all help.

Judi
 
Judi,

Sorry to hear you suffered property damage and loss of power, but, as you said, you were lucky compared to so many other people so much worse off.

I read that MULTILOCKS ON must be issued.

Yes, that's right. I usually set it on at the start of the program and leave it enabled throughout.

The form I have currently displays the info for the first customer on loading. I was thinking of a button 'Add' which will clear all fields and await entry.

Here's what I do. In the click of the "Add" button, I do an Append Blank, followed by a Refresh. That will, in effect, clear the previous record from the screen. The user can then fill in the fields, and hit either Save or Cancel.

In addition, I save the existing record number to a form property just before the Append Blank. Then, if the user cancels, I go back to the saved record and refresh. If you don't do that, the user would be at the end of file after cancelling the new record, which is non-intuitive.

I didn't mention this before, but I also have an Edit button. This puts the form in "edit mode". When I first launch the form, all the data-entry controls are read-only. The Edit button makes them read-write (and so does the Add button). Save and Cancel put them back to read-only.

Also, when in edit mode, I disable the navigation controls. If you are using row buffering, this is pretty well essential, because if the user navigates off a record while it is being edited, the edits are implicitly committed, which might not be what you want. This isn't an issue with table buffering, but either way, disabling navigation during editing is less confusing for the user.

I should stress that all of the above is based on my own practices. If other people do it differently, I won't say that I'm right and they're wrong. There are other valid approaches to these issues.

Good luck with your classes.

Mike




__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Mike,

Thanks so much for giving me one approach to this issue. As I have said, once I get started I have no problem going from there and usually I can scan the commands in help and discover other features needed to continue. What you suggest is exactly what I was trying to decide how to do.

Append blank, Refresh! [blush] I don't know why I am trying to give blank values to all fields through some property or method. As Bruce said, I am trying to reinvent the wheel.

Thanks for all

Judi
 
Hi Mike - you deserve a star for the detail in which you described this. I am forwarding to all my programmers to review! Thanks
 
Mike,

I am so glad you are getting some recognition for your great help! I feel that you need a star each time for the patience you have and the clear, straight to the point instructions you give.

Judi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top