A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Dynamic filling of Data in a form



 
 
Thread Tools Display Modes
  #1  
Old May 27th, 2005, 10:05 PM
Greg
external usenet poster
 
Posts: n/a
Default Dynamic filling of Data in a form

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
  #2  
Old May 28th, 2005, 02:35 AM
John Vinson
external usenet poster
 
Posts: n/a
Default

On Fri, 27 May 2005 14:05:01 -0700, "Greg"
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]
  #3  
Old September 16th, 2009, 07:20 PM posted to microsoft.public.access.gettingstarted
John Bartram
external usenet poster
 
Posts: 1
Default Dynamic filling of Data in a form



"John Vinson" wrote:

On Fri, 27 May 2005 14:05:01 -0700, "Greg"
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]

  #4  
Old September 16th, 2009, 07:27 PM posted to microsoft.public.access.gettingstarted
John Bartram[_2_]
external usenet poster
 
Posts: 1
Default Dynamic filling of Data in a form

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"
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]

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help In Printing Current Record in Specific Report RNUSZ@OKDPS Setting Up & Running Reports 1 May 16th, 2005 09:06 PM
setting up a form to connect to a sub form and data input question Edward Letendre Using Forms 0 February 26th, 2005 12:23 AM
SQL view of messed up action queries Kendra Running & Setting Up Queries 2 August 31st, 2004 09:53 PM
Strange stLinkCriteria behaviour on command button Anthony Dowd Using Forms 3 August 21st, 2004 03:01 AM
Form Doesn't Go To New Record Steve New Users 15 May 16th, 2004 04:33 PM


All times are GMT +1. The time now is 07:26 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.