Tip:
Highlight text to annotate it
X
I usually start
LibreOffice Base video saying I made a copy the database
I was using in previous video but that database
has a problem so I created another database
from that database and called that odb10
gender-text-varchar that database
can be found on the website. We're going to show how to add
action buttons also known as radio buttons twice
once with the new database I named odb 10
gender-text-varcher and once
with the odb10-filter-background as the input
I've made a copy odb-10
gender-text-varchar which i download from the website
and rename this to odb11
gender-text-varchar and opened up the form
I want to add some radio buttons to this form
LibreOffice Base calls these option
buttons most people are more familiar with the term radio button
because they're similar to the buttons you will see on a radio
think the buttons on a car radio, they are all tuned
to different stations and you can select any one
but when you select that one it changes to the new station
in other words you can only have one selected
at a time. Radio buttons or option buttons
work the same way, they offer us a choice of options
but we can only choose one of the options. We are going to
add some option buttons to this form and the best
field for their would be the gender because we must choose between
either male or female. To add in the radio buttons
I'm going to close the form and
open it back up in edit mode. The first thing I'm going to do
is hold down Control and click on the gender text box
I'm going to shrink this down a little bit and move it off to the right
we're going to leave this on here for a few minutes to see the field
as well as the option buttons. The option button
is found in the lower middle part the form controls
I'm going to click that and add one
for male and one for female.
I'm going to select the one I want to make male,
first I'm going to open up the Properties box
by right-clicking and clicking on control Let's move this over to the right
under the Data tab we're going to give this a name
will call this optMale
give this a label of "Male". Now we're going to click
on the "data" tab, we went to change data field
to be gender and the "reference value
on" we want to make "Male". Now let's do the same thing with
the female option button going back to "General"
Renaming this to optFemale
Label of Female
and will see that update
when I hit tab or enter. Going into the "data" tab
we want the same data source "gender"
"reference value on" to be
Female. Closing our properties box
The last thing I want to do is select both of the
option buttons right click
and group these together. Now let's go into design view
and see if they work. We had something selected so we're not seen early peoples
but if I click outside the labels the show up again
so our first one is showing up as "Male"
now "Female"... "Male"... "Female"
So, these appear to be working but as we've seen before
when we add a new button it puts it to the bottom of our tab list
so let's go back into edit mode or design mode
we can get rid of our gender text box I'm going to hold down Control
and click on the text box, hitting delete
it's gone. Now we want to fix the tab settings by coming down
into the activation order
and we see at the bottom are option male and female
and we want to move these up to just
under first name.
Clicking OK let's review this in
design view putting the cursor in last name and hitting
tab we see it goes to first name
to male in then to start date it's not going to female
if we click and the next one we see female
I'm putting the cursor into last name
first name and it jumps to female
then when I click Next jumps down to start date. Don't go crazy trying to make it tab
through
you radio buttons its only going to go to one of the values
in the radio button group. So, lets change one, to see how it works.
I'm going to change Patricia Anderson to male.
I will save this... Go to in the next record...
When we come back, we see that she's male. Let's make her
a Female again. Save
Next record, previous, and now she's back to female.
The rest the video is going to show what the problem is with the odb10
filter-background, and how to fix it.
I've made a copy of odb10 filter background
in rename this to odb11 radio button
I'm going to go into the tables option in database
and we see we have "employees" as well as
forms employees to make sure we know the difference between which one we're going
into
I'm going to rename this one
to frm
dash employees
and also going to rename this other one
to frm
employees-spreadsheet-view. That is so I can tell the difference between my forms
and my tables, when I'm clicking on the different options.
Let's edit are Employees table
and we're going to come up to gender
instead of text fixed character
we're going to change this to text varchar
and save.
Closing our table... Let's go back into our forms
and let's bring up our form in spreadsheet view
and now we want to look at just the males in the table
so I'm going to quick and my autofilter
We want to change all these fields because when I click on it
let me zoom in a little - We can see that
we've got male, space, space
because when we had that fixed character it added in
those two spaces when we have a field is var char
it removes those extra spaces at the end
when we edit it, when we add that field. But since we converted this one from
fixed, it didn't reformat all these values.
So, we're going to have to reformat them our-self.
Unfortunately we don't know enough about queries to do that yet,
So, we're going to have to do this all by hand.
What I'm going to do is on this first one I'm going to delete off the extra
spaces.
Then select the four characters we do want,
I'm going to hold down Control hit "C" for copy
Then I'm going to hit my arrow down button and hold down Control
and hit cntl+V for paste
arrow down, control+V, arrow down
control+V
and do that all the way down.
Now when I click up we see that there are four character "Male"
and I know some you are probably thinking, "What if we put it in quotes, and have
two spaces at the end of our option button" It didn't work, I tried it...
Maybe you can get it to work... If you can, please add it in thenotes under the video (how you did it)
but I had trouble getting a fixed character to work with the option
buttons.
So, we're going to close his form we didn't do any updates to it; so, we don't
need to save anything.
it already saved the data into our table.
Let's come down to form, employees, right click
Edit, and we're going to do just what we did
earlier in the video I'm going to hold down Control
Click on the gender tab, but this time I'm going to delete it right away
I'm going to click on our option button
add that, and add another one
select the one on the left.
Click on the control button to open up our properties box.
The first one's going to be optMale
and Malel for a label
Gender, reference value on
Male
Going back to our General tab
optFemale
label is Female
"Data" Gender - reference value on
Female. Closing the Properties box
Selecting our 2 option buttons
grouping them together
and I going to use my arrow key to move them up a little bit
we're also going to change the tab order, right away.
Selecting these 2 moving these up
Clicking OK. Now let's go to design view
and we had something selected, to get rid of this, I'm going to click
outside of all our objects.
and we see that it's working
On our navigation bar, we have this thing called
"Data Source as Table". If I click that,
Up at the top, it shows us our data source.
This is another way we can check the data, and see if it is updated properly.
We are at Patricia Anderson. We see her right here here
and, I'm going to change her to male
Clicking that, we see under gender, it's changed already to male. I didn't
even have to click on the save record.
Changing her back to female, will watch this change
and we see that is is updated. So, our Data source
shows us the table that were pulling that data from.
Let's close that, and we have our option buttons
working for odb11-Radio-Button
I'm going to save this form
close our form and it's asking us if we want to save your changes
we did make a change to this form so I want to say yes
I'm going to receive the database and we're done.
all all cool