Ask Your Question

Base: Added field to form [closed]

asked 2015-02-06 22:06:46 +0100

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I created a database using the Table Wizard for "Contact" and added two fields to it. Whenver I enter anything in either of the two new fields, I get a "0." I went to the design of the field in the database and it reads correctly, that the field is supposed to have 100 text spaces. Also, I created a query with all of the data in the right order. How do I ensure that the form is connected to the query and not to the original database? Thanks!

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2020-08-15 16:08:38.998669


It sounds like the form controls in question are numeric controls. I replicate the same functionality -- a display of 0 on a text field (actually, 0.00) when viewed through a numeric control. In design view for the form, enter the control properties box. Confirm type by title in heading. In form navigator, Icon 123 also will be displayed.

doug gravatar imagedoug ( 2015-02-07 13:11:36 +0100 )edit

Hmm, many thanks. I checked and sure enough, if I enter numbers, it works fine. It's only when I enter text that it imediately becomes a zero. Checked the data file and it reads "Text [VARCHAR]" and the format of the form field and that reads "@" so I'm not at all sure where the problem could be.

Rich2506 gravatar imageRich2506 ( 2015-02-07 14:58:06 +0100 )edit

2 Answers

Sort by » oldest newest most voted

answered 2015-02-08 01:12:22 +0100

Rich2506 gravatar image

updated 2015-02-08 01:13:29 +0100

Re-did the form with a wizard. It was based on a query that organized the data just the way I wanted it and all the fields came out in the order I wanted them. Problem: I can''t edit anything! I can't change any of the data via the form, which kinda defeates the whole purpose of having a form in the first place! Completely appreciate people's efforts here, but man, dBase 5.5 (A 90s program) was SO much easier! It was simple and straightforward and you could understand everything!

edit flag offensive delete link more


Some possibilities that might apply: table needs a primary key, query with joins may be non-updatable, and form properties data should have Allow modifications yes, properties of individual controls should not be read only and should be enabled. Sounds like query wizard is not doing the right thing.

doug gravatar imagedoug ( 2015-02-08 04:29:53 +0100 )edit

So the primary key should be a single column/data element? Hmm, yeah, I can do that. Thanks!

Rich2506 gravatar imageRich2506 ( 2015-02-10 02:50:15 +0100 )edit

%$#@$!!! I added a field and then clicked on the option to make it my primary key. It then told me it couldn't accept my key and suggested a way to make a primary key that didn't work. Sigh!! I guess I have to mak the whole database from scratch AGAIN!!!

Rich2506 gravatar imageRich2506 ( 2015-02-10 03:11:52 +0100 )edit

I can't speak to your specific problem, but if the table does not have a primary key, the key itself can be added to an existing row by right mouse clicking on the left side selector in edit mode, and then selecting the option primary key. The column will need to have unique data. The HSQLDB guide says that multi-column primary keys are supported, but I don't see a way in the LO user inferface.

doug gravatar imagedoug ( 2015-02-10 14:36:20 +0100 )edit

Many thanks for your patience on this. Adding the extra column/data element is simple. It's turning it into a primary key that's kicking my butt. When I tried to make it into a primary key, it says that it will do something automaticaly involving deleting the column and re-creating it so that it's a good primary column. Then it says it can't delete the column. I can delete it, but then I have to start all over again.

Rich2506 gravatar imageRich2506 ( 2015-02-11 02:35:34 +0100 )edit

Hmm, is there some way to access the Base SQL code directly? I go into HTML code and fool around "under the hood" all the time. Can I do it with Base?

Rich2506 gravatar imageRich2506 ( 2015-02-11 02:36:42 +0100 )edit

Yes, you are right. The 'under the hood' tool is available through menu option Tools --> SQL, and in addition the command you are looking for is ALTER TABLE "Table1" ADD PRIMARY KEY ("column1", "column2") It tests ok on my end, both columns are displayed in UI as primary. Alternately, see instructions in LO guide appendix for extracting LO database into HSQLDB external-- not for the faint of heart.

doug gravatar imagedoug ( 2015-02-12 03:44:16 +0100 )edit

Awesome ! Thanks!

Rich2506 gravatar imageRich2506 ( 2015-02-12 15:36:18 +0100 )edit

answered 2015-02-07 19:26:48 +0100

doug gravatar image

updated 2015-02-07 19:33:33 +0100

That is a formatted field, with the correct format code for text formatting ... and I confirm it does not work for me also. However, it is unnecessary to use formatted field, instead use a text control.

To fix it all you need to do is to convert the formatted field controls that display zero back to text field controls. Open the form in design view (edit mode), right mouse click on the control in question and use menu entry replace with. At the top of the list you should see text box. Click that, it should work.

There are other control properties to consider as well, visible in the control dialog box, but the data source should remain unchanged in the operation above. Save, toggle design mode on/off and it should work as intended.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-02-06 22:06:46 +0100

Seen: 981 times

Last updated: Feb 08 '15