Ronald,
Ok, you are saying that a ServiceID is "selected" - but you don't say
how.
I'm assuming that its from a Combo-box and that you're made it like John
suggested
So, in that combobox's _AfterUpdate event,
do what John was trying to tell you to do.
put code in that does something like this:
if len(nz(me.txtMemoFieldCtlName.value, "") = 0) then _
me.txtMemoFieldCtlName.value =
me.cboSelectServiceIDCtlNameHere.columns(1)
This will put the value of the selected row from the combox's 2nd column
into the MemoFieldCtlName textbox on your form (but only if it is already
empty).
You can easily enhance this code to ask the user if they want to replace
what's in the textbox with the description again if it isn't empty...or
not.
Ronald Marchand said:
This is close to what I want.
I am not showing anything. A ServiceID is selected as the service
required
for this event. I am gathering the description of this service as a
default
value for a memo box. The user can accept this, modify it or replace it
with whatever is necessary to describe the event.
My problem is that this "description" is not in the form's data source.
But
I have the info to get it. Just do not understand how.
I want Services.serviceName where the key (ServicesID) is the value of
Event.ServiceID.
Thanks for trying.
Ron
If all you want is to SHOW the value on your form, just set the
control's
Control Source to something like
Control Source: =[NameofCombobox].Column(1)
Columns are zero-based so that will show the value of the 2nd column
in
the your combobox. An alternative is the change the settings of the
combobox so that it displays the description while it stores the
Service
ID. Assuming that you have a two column combobox, on the Properties
Format tab of the combobox set column widths as follows
Column Widths: 0;
That will hide the first column and display all the other columns that
you
have in the combobox.
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
.
Thanks, but I think I have not explained my point properly.
In a nutshell. a service type is stored with its ID and
NameDescription
in its table.
I am creating a table named "Events". One of the fields of this
table
contains the ServiceType Key and is a combo box to look it up.
During
the lookup the service name's description is visible to the user.
After
the serviceID is assigned to the form, an after_update checks whether
or
not the event description is null and if it is, it is to be set to
the
value retrieved from the services table.
I do not understand how to assign the value, and yes I am new to
database
development.
Ron
Generally in a database, you store the "code" value in many tables
and
one
table where it is the primary key. You store the 'longer text field'
in
only
one record in one table. That is how relational databases work.
--
Duane Hookom
Microsoft Access MVP
:
I would include the table Services in your form's record source.
If
you
can't
do this, change the text box to a combo box with Services as the
Row
Source.
The field is a longer text field and I am attempting to set some
default
text based on the serviceID code entered. During that lookup, the
text
is
visible to the user but I do not know how to capture it for "later"
use.
Can you set a form to two different tables at the same time?
Thanks
Ron
--
Duane Hookom
Microsoft Access MVP
:
I know that this is not actually a query.
I have a form that has a value set in Me.ServiceID.
In a table Services (which is NOT the data source for the form)
there is
a
pair of values, ServiceID and ServiceName.
How can I find (specify) the ServiceName using Me.ServiceID?
I have an IF statement assigning Me.Description equal to this
value
TIA
Ron