Help!

Dynamic filling of Data in a form

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Getting Started RSS
Next:  Excel to Access  
Author Message
Greg
External


Since: Jan 10, 2005
Posts: 154



PostPosted: Fri May 27, 2005 2:05 pm    Post subject: Dynamic filling of Data in a form
Archived from groups: microsoft>public>access>gettingstarted (more info?)

A simple question for people who know Access. I am using Access 2003 and have
a simple table in which I enter Goods and a Price for that item. I have set
up a form that has 2 single fields that wants to use this data. The 1st field
is a combo box in which you select the goods, then I want the corresponding
value from the Price column to automatically populate the other field, but I
can't seem to get it to work.

Does anyone have the answer.

Regards
Back to top
John Vinson
External


Since: Sep 17, 2003
Posts: 9558



PostPosted: Fri May 27, 2005 7:35 pm    Post subject: Re: Dynamic filling of Data in a form [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Fri, 27 May 2005 14:05:01 -0700, "Greg"
<Greg DeleteThis @discussions.microsoft.com> wrote:

>A simple question for people who know Access. I am using Access 2003 and have
>a simple table in which I enter Goods and a Price for that item. I have set
>up a form that has 2 single fields that wants to use this data. The 1st field
>is a combo box in which you select the goods, then I want the corresponding
>value from the Price column to automatically populate the other field, but I
>can't seem to get it to work.

Will the price change over time? do you want to display the price as
of the time that you select the Goods (and have that price remain
static even if the Goods table changes later)? That would be the ONLY
reason to store this Price field in your second table.

If you do want to do so, include the Price in the Combo Box's
RowSource query; put the following VBA code in the AfterUpdate event
of the combo box (by clicking the ... icon and choosing Code Builder):

Private Sub cboGoods_AfterUpdate()
Me!txtPrice = Me!cboGoods.Column(1)
End Sub

I'm assuming the combo box is named cboGoods, the textbox containing
the price named txtPrice, and that the price is in the second column
of the combo's query - the Column() property is zero based.

John W. Vinson[MVP]
Back to top
John Bartram
External


Since: Sep 16, 2009
Posts: 1



PostPosted: Wed Sep 16, 2009 11:20 am    Post subject: Re: Dynamic filling of Data in a form [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"John Vinson" wrote:

> On Fri, 27 May 2005 14:05:01 -0700, "Greg"
> <Greg.RemoveThis@discussions.microsoft.com> wrote:
>
> >A simple question for people who know Access. I am using Access 2003 and have
> >a simple table in which I enter Goods and a Price for that item. I have set
> >up a form that has 2 single fields that wants to use this data. The 1st field
> >is a combo box in which you select the goods, then I want the corresponding
> >value from the Price column to automatically populate the other field, but I
> >can't seem to get it to work.
>
> Will the price change over time? do you want to display the price as
> of the time that you select the Goods (and have that price remain
> static even if the Goods table changes later)? That would be the ONLY
> reason to store this Price field in your second table.
>
> If you do want to do so, include the Price in the Combo Box's
> RowSource query; put the following VBA code in the AfterUpdate event
> of the combo box (by clicking the ... icon and choosing Code Builder):
>
> Private Sub cboGoods_AfterUpdate()
> Me!txtPrice = Me!cboGoods.Column(1)
> End Sub
>
> I'm assuming the combo box is named cboGoods, the textbox containing
> the price named txtPrice, and that the price is in the second column
> of the combo's query - the Column() property is zero based.
>
> John W. Vinson[MVP]
>
Back to top
John Bartram
External


Since: Sep 16, 2009
Posts: 1



PostPosted: Wed Sep 16, 2009 11:27 am    Post subject: Re: Dynamic filling of Data in a form [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I tried this with a form I am working on that will be used for invoicing and
got "Run-time error 451" (Property let procedrue not defined and property get
procedure did not return an object). what am I doing wrong?

The two fields I am working with are
"Part Number" which is a combo box and "Part Name" that is a text box and I
want to automatically display and store the part name based on the part
number selected.

"John Vinson" wrote:

> On Fri, 27 May 2005 14:05:01 -0700, "Greg"
> <Greg DeleteThis @discussions.microsoft.com> wrote:
>
> >A simple question for people who know Access. I am using Access 2003 and have
> >a simple table in which I enter Goods and a Price for that item. I have set
> >up a form that has 2 single fields that wants to use this data. The 1st field
> >is a combo box in which you select the goods, then I want the corresponding
> >value from the Price column to automatically populate the other field, but I
> >can't seem to get it to work.
>
> Will the price change over time? do you want to display the price as
> of the time that you select the Goods (and have that price remain
> static even if the Goods table changes later)? That would be the ONLY
> reason to store this Price field in your second table.
>
> If you do want to do so, include the Price in the Combo Box's
> RowSource query; put the following VBA code in the AfterUpdate event
> of the combo box (by clicking the ... icon and choosing Code Builder):
>
> Private Sub cboGoods_AfterUpdate()
> Me!txtPrice = Me!cboGoods.Column(1)
> End Sub
>
> I'm assuming the combo box is named cboGoods, the textbox containing
> the price named txtPrice, and that the price is in the second column
> of the combo's query - the Column() property is zero based.
>
> John W. Vinson[MVP]
>
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Getting Started All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum