| View previous topic :: View next topic |
| Author |
Message |
maxqnz Super User


Joined: 24 Mar 2003 Posts: 1290 Location: Te Ika a Maui, Aotearoa
|
Posted: Mon Apr 10, 2006 2:26 pm Post subject: Auto fill-in fields on a form? |
|
|
This is a real kl00less n00bie type question, but if I have a form, how do I get some fields automatically filled in based on user entry in other fields? For example, if a user types in their Staff ID, how do I get the "first Name", "Last Name" fields filled in, or the "Project Name" field and Project ID" fields after the user enters "Job Nr"? _________________ Noho ora mai, ka kite ano.
What Is A Pieriansipist?
OOo 2.4/XP Pro SP2 / OOo 2.3.0.1/OpenSuse 10.3 |
|
| Back to top |
|
 |
heatherbowater Newbie

Joined: 19 Apr 2006 Posts: 1
|
Posted: Wed Apr 19, 2006 1:31 am Post subject: |
|
|
| This is the sort of thing I want to know, too. It's probly just a termnolgy thing, but it would be nice to know how to do it. |
|
| Back to top |
|
 |
DrewJensen Super User


Joined: 06 Jul 2005 Posts: 2616 Location: Cumberland, MD
|
Posted: Wed Apr 19, 2006 4:32 am Post subject: |
|
|
Well, I am not sure if I understand the question -
As far as I can see you have a couple of choices:
Default property for each control
Every UI control has a default setting available via the property inspector, or at runtime via the API.
CheckBox -> Default Status
TextBox -> Default Text
FormattedField -> Default Value
ComboBox -> Default Text
ListBox -> Default Selection
......
etc.
Now for a second way. In Base using the table design editor you can assign a default text value to a column. This text will be entered into any control that is bound to this column, when a new record is inserted into the table. Only string literals are allowed for this default value, but a numeric field will convert an appropriate string to a number, and a date field the same so you can pretty much create a default for any column type. This IS NOT the same as having a default value on a column at the database engine level, this default text is used only by Base forms and data view grids.
Finally, you can create a macro that will fire on the action of inserting a record. In this macro you could set any control any way you like.
Something that won't work:
You can create default values at the database engine level. How you do this would depend on the engine (server) that you are connecting to. With this apporach the Base form will not, as far as I know, pick the value up for display. I don't really think it could, since the value doesn't exist until the new reocrd is posted to the database. |
|
| Back to top |
|
 |
bajintas General User


Joined: 12 Apr 2006 Posts: 10 Location: Tasmania
|
Posted: Wed Apr 19, 2006 3:53 pm Post subject: |
|
|
Hi,
Watching your thread and wondering if theres a way to mimic the way this would be done in Access. That is, by editing the Control Source and Row Source properties of the controls.
The Row Source of "StaffID" (The StaffID control would be a ComboBox) would be a SELECT statement something like SELECT Staff.StaffID FROM Staff;
The Control Source of "FirstName" and "LastName" would be "StaffID".
The Row Source of "FirstName" would be something like SELECT Staff.StaffID, Staff.FirstName FROM Staff.
and something similar for LastName.
I cant find anything like this in Base but then, I am very new to Base
This seems to work quite well in Access but I'm not suggesting that this is the best way.
Its because of "The Microsoft Way" that I'm trying to learn Base. _________________ Bob |
|
| Back to top |
|
 |
linchat Newbie

Joined: 19 Apr 2006 Posts: 2
|
Posted: Wed Apr 19, 2006 5:20 pm Post subject: Auto Date |
|
|
I am glad this subject came up! Is it possible during table design to auto-date by setting the default value on the table? How can this be done on a form?
Thanks |
|
| Back to top |
|
 |
|