Data In Form

Discuss the database features

Data In Form

Postby RobmUK » Wed Aug 09, 2017 11:00 am

I'm new to Base, but have created databases in Access before. I'm having trouble with a simple database with a form and subform. I've created two simple tables, one with a machine name, and the second holds information on who used it, on what date, and for how long. On the machine table, I have a serial number, and the machine name. The serial number is an autonumber, with a primary key. The second also has a serial number, but I haven't set a primary key. I set a one to many relationship in Access, and this worked, but I don't know if I've got things right in Base. I created a form, with the machine and serial number on it, and a sub form, for the usage details. I can enter data into the main form, but not the sub form. Can someone suggest where I'm going wrong? Thanks.
Open Office 4 Portable Windows 7
RobmUK
 
Posts: 1
Joined: Wed Aug 09, 2017 9:52 am

Re: Data In Form

Postby Arineckaig » Wed Aug 09, 2017 12:04 pm

Can someone suggest where I'm going wrong? Thanks.

Welcome to the forum.

Much the quickest way to get an answer to your problem is to upload a token copy of your Base file: a token copy has all sensitive data removed but replaced by one or two illustrative token records. It is easier to track down the source of problems with a realistic sample, whereas a description of the file can often be open to misinterpretation.

See here for how to upload a file to the forum.
When this issue has been resolved, it would help other users of the forum if you add the word - [Solved] - to the Subject line of your 1st post (edit button top right).
AOOo 4.1.5 & LO 6 on MS Windows 10 MySQL and HSQLDB
Arineckaig
Volunteer
 
Posts: 828
Joined: Fri Nov 30, 2007 10:58 am
Location: Scotland

Re: Data In Form

Postby UnklDonald418 » Mon Aug 14, 2017 4:12 am

I can enter data into the main form, but not the sub form … The second also has a serial number, but I haven't set a primary key.

To enter new data on a Base Form or SubForm it must have a Primary Key because the HSQLDB engine requires a Primary Key to differentiate between records.
When you create a table using the Base Table Design GUI and try to Save it without a primary key it offers to create a Primary Key. Unless you are an advanced designer and understand the implications you should always accept that offer.
You should be able to add a Primary Key to your existing table using Tools->SQL and executing an SQL statement something like
Code: Select all   Expand viewCollapse view
ALTER TABLE "YourTableName" ADD COLUMN "ID" INTEGER GENERATED BY DEFAULT AS IDENTITY (start with 0) ;

Then make sure your data source for the SubForm includes the ID field. Next add a Numerical control for the ID field to your SubForm. It can be hidden from view but it must exist on your SubForm.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.5 & LibreOffice 6.0.4.2 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 965
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA


Return to Base

Who is online

Users browsing this forum: No registered users and 2 guests