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

how do I use a form to add or edit table data

Status
Not open for further replies.

crystalaid

IS-IT--Management
Jun 11, 2003
11
AU
Hi there,

Could anyone please tell us how we can create a form so we can use the form to add records to our table and also to edit data in the table using the form.
Currently we edit data using the table and we want to use the form instead. Is this possible?
Many thanks
Brad
 
Crystalaid,

try using "file, new, form" and then using the form expert. This will allow you to place the fields you want on the form and then a simple press of F9 will put you into edit mode........OR you can then move on to putting your own buttons on the form, but that's another question.

Trust this helps,

Lewy
 
Paradox also has a form expert that is very usefull in setting up forms. This will allow access to 1 2 or multiple tables. The expert "walks" you through the basic set up. If you are not satisfied with the look or you want to tweak it you can access the form in the project viewer. To do so right click on the form, select design option. You can then change appearance of the form, add colors, change field positions, add buttons for filter/edit etc. The paradox experts are very usefull to the user who is new or not versed in the programming code. There are experts for many applications.

Hope this helps

Greg
 
Very easily. You will find good information on the Corel Support site, but you don't need it. Forms are the fun part of Paradox.

Do as Lewie and Crystal Aide say. Just to try it don't worry about color. Choose the expert. It will ask you how many tables. Choose one and choose your table.

You will see a list of the fields you want to enter. I would suggest you take a trial run with just a couple. Chose to have your data arranged in rows or colums - there will be a sample picture on the right. Click on finish.

Once your form is up the same rules apply to data entry as in a table: f9 toggles entry on or off, etc. Ctrl D enters the same data in the next table, Ctrl Z opens a search window for a field, etc.

You can enter and retrieve single records from a form more easily than from a table. I have a viewing form for my answer.db from queries. If you want to view compilations from multiple records, a report may be better.

Since you have a sample table up you can play a little with it by going into design mode (f8). From the standard bar you can pull down various elements to create an interface which serves your needs. You can tweak them by using the properties interface (easy) or the object explorer (a little more complicated.)

Some of the tricks for quick data entry are:
Use radio buttons or check boxes for yes, no (true false, etc) answers. You can choose these either when you enter a new field from the standard bar or by choosing changing "display type", edit by default, in the property box.

If you have great deals of information to add, but you only deal with one segment at any specific time try grouping your various pieces on the Notebook Tool. (looks like a manilla folder).

If you have fields in which you want a finite number of fixed options (for instance: New, Used, Rebuilt) you can enter these into a combo box (choose this when you pull down a new field or via display type.

Tip: Set your developer preferences to "advanced" in the table view. This will permit you to add vertical scroll bars in larger fields or memo fields in the Form via the Object explorer.

Nifty use of the form: View documents. You can use the notebook tool (although most of the experts here would rather enter code..I'm just lazy)as a sort of scrap book for documents to view. Note that you can only view one page.
Enter them in the table as OLE fields - I have resumes of my people and pictures of their work. Put them on different pages of the notebook and just click to read. You can either insert them or link them via cut and paste.

The best way to deal with a form is just to play with it. I have at this point several forms which provide the support for my work - entry and recovery of data (I recruit for restaurants and hotels, so I need pictures, resumes, information regarding specific skill sets, etc). It will take a while for you to get up to speed with the details, but it can be as fascinating as exasperating.

All of my incoming calls, for instance, are logged. I have a date field for receipt and for completion of the call. The completion field is filtered to show only when it is empty (filters can be very useful in forms. If you set them in design mode, they will be constant. If you set them in edit mode, they will disappear as soon as you close the form). So, all I see are the calls which I haven't returned. I have a similar form for tasks to be completed (ACT! eat your heart out). Each of these forms has a button with which I can call up the other or my main data entry form (use the button tool..again much fun.) and buttons which will add new records at the end of the table (last one on the list), go to the next record, search for specific data and delete records. You can also insert buttons to open folders or other programs, and just about to do anything but wash your dishes. I tend to get distracted and fiddle with buttons when I should be talking to country club chefs.)

I have to ask the question I came here to ask now, because otherwise I will get started on color schemes. (...a delicate maize with periwinkle......)
 
Jockley,

reading your wealth of information reminded me of the one function missing in P7 onwards and that is the 'alt-z' key combination used to locate the next occurance of data, sooo useful in the Dos version of Paradox. Anyone know of a way to code this into an application?

Regards,

Lewy
 
Lewy,

Um, Ctrl+Z is already coded for that purpose in the UI, but you can add that to a form by adding code along these lines to the form's keyPhysical event:

Code:
method keyPhysical(var eventInfo KeyEvent)
var
   strTable String
endVar

	if eventInfo.isPreFilter() then
      strTable = active.getProperty( "Tablename" )

      if strTable.isAssigned() AND strTable <> &quot;&quot; AND
         eventInfo.isControlKeyDown() then

         if eventInfo.vChar() = &quot;F&quot; then
            disableDefault
            active.menuAction( menuRecordLocateValue )
         endIf
      endIf
	endIf

endMethod

Now, you'll notice that this is more detailed than what's usually recommended. Here's why:

1. MenuRecordLocateValue (and other data menu actions) are only applicable when the active object (the one with focus) is actually bound to a table. For example, if you trigger this menuAction when focus is on a button, you'll receive an error. This code works with that by ensuring the active object is data aware, e.g. it has a Tablename property and that property actually has a value.

2. By default, buttons receive focus when clicked; they become the active object. If you're using buttons to trigger this sort of result, you need to set the button's Tab Stop property to FALSE; otherwise, you'll get the error mentioned earlier.

3. While I dislike using disableDefault as a general rule, it's useful in this case. In general, it's preferable to use eventInfo.setErrorCode( userError ) instead. (Reasons are far too complex to go into here and there are different viewpoints in the community.)

4. As a general rule, I do not normally use compund IF statements in ObjectPAL (for Paradox doesn't use short-circuit evaluation and unassigned values will raise errors that are difficult to debug). I used one in this case because I could guarantee that all conditions in the compound evaluation would have values. this needs more extensive discussion, but please use compound evaluations with care.
5. Also, you'll notice that I remapped Ctrl+F for this action, since Ctrl+Z is provided by default.

Hope this helps...

-- Lance
 
Or: Ctrl +A.

I have GOT to get down to learn Object Pal. As I said, just lazy.


I keep picking up new shortcuts. There's a list somewhere I'd like to go through again. Anyone know where it's located?

In the meantime I have just figured out (after HOW many years??? Slow learner here) That you can use the scroll on your mouse to &quot;page&quot; through records. How cool is that?
 
Ctr-a eh! Wow just perfect. If anyone has the list of shortcuts, will be most apreciated.

Off on my Hols tomorrow - speak to you all in a week.

Regards,

Lewy
 
First, please be patient for I am very new at Paradox.

I imported data via a csv file to make a table, then used the forms wizard to create a form. It works great as far as being able to view and edit existing data. I cannot, however, add new data to the table.

In form design view, all the options under the properties has a locked lock in front of it. I am assuming that that means the options are locked. I can't change anything there, anyway. How can I unlock the table to be able to add to the database?

I appreciate your help.
Elaine
Please visit our home page at
 

You should be able to add records. Open the form, press F9 then press the insert key. this should get you a blank form to input the data.

Hope this helps

Greg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top