Auto populate

  • Thread starter Thread starter TyF
  • Start date Start date
T

TyF

On my form I have two controls

Material Number Material Description

I would like for the Material Description to populate with the material
number is entered.
How do I make this happen?
 
TyF,
Create a 2 column combobox (ex. name = [cboPartNo]) based PartNos and
Descriptions from your Parts table.
Example... (use your own object names)
(Col1) (Col2)
PartNo Description
14E23 Bolt
1524F Flange
G51-22 Bracket

On the AfterUpdate event of your combo (ex. name = [cboPartNo]), update
the PartDescription...
PartDescription = cboPartNo. Column(1)
(Access numbers the combo columns 0, 1, 2, 3, etc)
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
Al,

I just received this error message:

Access was unable to locate the macro or VBA function. If you are trying to
call a macro, make sure that the name of the macro and the name of the macro
group are spelled correctly.

If you are trying to call a user-defined VBA function, be sure to use the
following syntax:

=FunctionName() or =FunctionName(argument1,argument2,...)

Make sure that the function is either:

Defined in the code for the form or report.
- or -

A public function that is in a module (not a class module).

Al Campagna said:
TyF,
Create a 2 column combobox (ex. name = [cboPartNo]) based PartNos and
Descriptions from your Parts table.
Example... (use your own object names)
(Col1) (Col2)
PartNo Description
14E23 Bolt
1524F Flange
G51-22 Bracket

On the AfterUpdate event of your combo (ex. name = [cboPartNo]), update
the PartDescription...
PartDescription = cboPartNo. Column(1)
(Access numbers the combo columns 0, 1, 2, 3, etc)
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

TyF said:
On my form I have two controls

Material Number Material Description

I would like for the Material Description to populate with the material
number is entered.
How do I make this happen?
 
TyF,
What is the code you used, and where did you put that code?
Are you trying to put the code I gave in the AfterUpdate event field?
Have you ever done any VB coding, using the form's module?

I'm going to assume not... (I'll use a combobox named cboPartNo)...
and that you put my code in the text box just to the right of the
combo box's AfterUpdate event. That's not where it belongs.

Place your cursor in the combo box's AfterUpdate text control box.
Using the little down arrow to the right of the box, select [Event
Procedure]
Now, click the 3 dot button on the right of that control (...)
You are now in the form's module, and should see this...

Private Sub cboPartNo_AfterUpdate()

End Sub

Now put my code in there...

Private Sub cboPartNo_AfterUpdate()
PartDescription = cboPartNo. Column(1)
End Sub

Close the module, and return to the form design screen.
Whenever you enter, or change, the cboPartNo value, the associated
description in your second column will populate your PartDescription
control.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."


TyF said:
Al,

I just received this error message:

Access was unable to locate the macro or VBA function. If you are trying
to
call a macro, make sure that the name of the macro and the name of the
macro
group are spelled correctly.

If you are trying to call a user-defined VBA function, be sure to use the
following syntax:

=FunctionName() or =FunctionName(argument1,argument2,...)

Make sure that the function is either:

Defined in the code for the form or report.
- or -

A public function that is in a module (not a class module).

Al Campagna said:
TyF,
Create a 2 column combobox (ex. name = [cboPartNo]) based PartNos and
Descriptions from your Parts table.
Example... (use your own object names)
(Col1) (Col2)
PartNo Description
14E23 Bolt
1524F Flange
G51-22 Bracket

On the AfterUpdate event of your combo (ex. name = [cboPartNo]),
update
the PartDescription...
PartDescription = cboPartNo. Column(1)
(Access numbers the combo columns 0, 1, 2, 3, etc)
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your
life."

TyF said:
On my form I have two controls

Material Number Material Description

I would like for the Material Description to populate with the material
number is entered.
How do I make this happen?
 

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

Back
Top