Display Text based on Selection from Combo Box

M

Maria

Please excuse my lack of experience – I am just starting to program in
Access. I am using Access 2003 – not sure if this is important to know. I
have a DB with 3 forms y 4 tables. 2 of my forms work, but it is the third
form where I am having the following issues: (please note that I placed ""
around any field, table or form name)

I do not have any Declarations for the DB except for the Option Explicit.
The form that is not working is "fmAlquiler". In this form I have a bound
combo box "RefMaq" that gets its data from the table "tblProductos" the
following are the properties for "RefMaq" in the form "fmAlquiler":

Row Source Type:: Table/Query
Number of columns: 2
Bound Column: 1
List Rows: 4
After Update Event: =Me.Marca=Me.RefMaq.Column(3)

Row Source:
SELECT tblProductos.RefMaq, tblProductos.RefMaq, tblProductos.MaqTipo,
tblProductos.Marca, tblProductos.Modelo, tblProductos.Combustible
FROM tblProductos
WHERE (((tblProductos.RefMaq) Is Not Null And (tblProductos.RefMaq) Is Not
Null) AND ((tblProductos.MaqTipo) Is Not Null) AND ((tblProductos.Marca) Is
Not Null) AND ((tblProductos.Modelo) Is Not Null) AND
((tblProductos.Combustible) Is Not Null))
ORDER BY tblProductos.RefMaq, tblProductos.RefMaq, tblProductos.MaqTipo,
tblProductos.Marca, tblProductos.Modelo, tblProductos.Combustible;

When I select one of the items from the combo box I would like 2 text fields
(only for display purposes) "Marca" and "Modelo" (also fields from the
"tblProductos") will be populated (again, only for display purposes). At
this point I am only doing the code for the text field "Marca" – once this
works I will apply the code to the text field "Modelo"

Therefore, this is the property for the text field "Marca":
It is listed on the same form "fmAlquiler" beside the combo box "RefMaq" and
it is not in a subform.
Name: Marca
Additional Information: Marca
Control Source: =RefMaq.column(3)

I think my problem is the After Update Event for the ComboBox "RefMaq" –
with the Me function (which I do not understand) – I am not sure if I am
missing a Load Form or other type of declaration

All help is very much appreciated

thx
Maria
 
J

June7 via AccessMonster.com

Me is used as an alias for the form or report name the code is running from.
Just a convenience so you don't have to keep retyping the form or report name.
Can also use the With command at beginning of procedure then don't even have
to type Me, example:

With Me
.textboxName = .cboboxName.Column(3)
.textboxName = !fieldName
End With

And if you are not familiar with the ! usage (called 'bang') this designates
a field of a recordset.
 
M

Maria

June7

Thank you for the explanation of the Me -- I think I understand the syntax.
At this point as I am quite new - I will be typing the forms name - Until I
get tired of typing and will be using your example.

take care and thx again
maria
 
M

Maria

Dear Ken:

Thank you - it worked like a charm - but I have another issue with the data
that is actually stored in the table. However, as it is another topic, I
will create a new topic

Thx again
Maria
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top