If then Statement

E

Evil_jay

I have 4 Fields On a form Product Id(Shows a description of my product
instead of it's Id Number),Quantity,UnitPrice,Price. I need to find out how
to make all of this work together

When I select a Product id, i want it to auto find the UnitPrice so that all
i have to do is type in a #value in the Quantiy Field And have it calculate
my total price.


Can anyone help me i thin ki need a iF then Statement But not sure How to
set it up on access 2003
 
D

Dennis

The best way would be to make the product selectable from a combo box and put
all the other fields that you need as columns in the combo box. You can then
set the control source of the text fields on the form to

=ComboBoxName.Column(1)
=ComboBoxName.Column(2)

etc.
 
E

Evil_jay

I'm not sure if we are on the same page(sry I may have explained it wrong) in
my product Id field (combo box) list all my products when i select a product
i want the amount of that product to auto post to my Unit Price field. The
expression i have already" Price=[UnitPrice]*[Quantity]" will already
Calculate my total once i input the Quantity needed. I just need to find out
how to make it work.... if you could tell me how to write the expression it
would help me out alot.
Thanks
 
D

Dennis

Assuming your product information is in a table called Products and your
combo box is called cmbProduct set the control source property of your Unit
Price field to

=DLookUp("[UnitPrice]","Products","[ProductID] = '" & Me.cmbProduct & "'")

Evil_jay said:
I'm not sure if we are on the same page(sry I may have explained it wrong) in
my product Id field (combo box) list all my products when i select a product
i want the amount of that product to auto post to my Unit Price field. The
expression i have already" Price=[UnitPrice]*[Quantity]" will already
Calculate my total once i input the Quantity needed. I just need to find out
how to make it work.... if you could tell me how to write the expression it
would help me out alot.
Thanks

Dennis said:
The best way would be to make the product selectable from a combo box and put
all the other fields that you need as columns in the combo box. You can then
set the control source of the text fields on the form to

=ComboBoxName.Column(1)
=ComboBoxName.Column(2)

etc.
 
E

Evil_jay

That didn't work My products are in a table Called Products also the Unit
Price is there for the product the combo box on my form is called ProductID.
I tryed what you wrote and it gave me #name? in the field for unit price....

Dennis said:
Assuming your product information is in a table called Products and your
combo box is called cmbProduct set the control source property of your Unit
Price field to

=DLookUp("[UnitPrice]","Products","[ProductID] = '" & Me.cmbProduct & "'")

Evil_jay said:
I'm not sure if we are on the same page(sry I may have explained it wrong) in
my product Id field (combo box) list all my products when i select a product
i want the amount of that product to auto post to my Unit Price field. The
expression i have already" Price=[UnitPrice]*[Quantity]" will already
Calculate my total once i input the Quantity needed. I just need to find out
how to make it work.... if you could tell me how to write the expression it
would help me out alot.
Thanks

Dennis said:
The best way would be to make the product selectable from a combo box and put
all the other fields that you need as columns in the combo box. You can then
set the control source of the text fields on the form to

=ComboBoxName.Column(1)
=ComboBoxName.Column(2)

etc.

:

I have 4 Fields On a form Product Id(Shows a description of my product
instead of it's Id Number),Quantity,UnitPrice,Price. I need to find out how
to make all of this work together

When I select a Product id, i want it to auto find the UnitPrice so that all
i have to do is type in a #value in the Quantiy Field And have it calculate
my total price.


Can anyone help me i thin ki need a iF then Statement But not sure How to
set it up on access 2003
 
D

Dennis

Is the Unit Price field in your table called UnitPrice ?
Is the product ID text or numeric ?
The DLookUp function basically says, get me the Unit Price field from the
products table from the row where the productID matches the one I have
selected in the combo box.
Is your combo box bound on the ID or the description of the product ?
You need to check all these things and then provide the relevant info in the
DlookUp statement.

Evil_jay said:
That didn't work My products are in a table Called Products also the Unit
Price is there for the product the combo box on my form is called ProductID.
I tryed what you wrote and it gave me #name? in the field for unit price....

Dennis said:
Assuming your product information is in a table called Products and your
combo box is called cmbProduct set the control source property of your Unit
Price field to

=DLookUp("[UnitPrice]","Products","[ProductID] = '" & Me.cmbProduct & "'")

Evil_jay said:
I'm not sure if we are on the same page(sry I may have explained it wrong) in
my product Id field (combo box) list all my products when i select a product
i want the amount of that product to auto post to my Unit Price field. The
expression i have already" Price=[UnitPrice]*[Quantity]" will already
Calculate my total once i input the Quantity needed. I just need to find out
how to make it work.... if you could tell me how to write the expression it
would help me out alot.
Thanks

:

The best way would be to make the product selectable from a combo box and put
all the other fields that you need as columns in the combo box. You can then
set the control source of the text fields on the form to

=ComboBoxName.Column(1)
=ComboBoxName.Column(2)

etc.

:

I have 4 Fields On a form Product Id(Shows a description of my product
instead of it's Id Number),Quantity,UnitPrice,Price. I need to find out how
to make all of this work together

When I select a Product id, i want it to auto find the UnitPrice so that all
i have to do is type in a #value in the Quantiy Field And have it calculate
my total price.


Can anyone help me i thin ki need a iF then Statement But not sure How to
set it up on access 2003
 
E

Evil_jay

Unit Price is Unit Price
Product Id :
Row Source :SELECT DISTINCTROW Products.* FROM Products ORDER BY
Products.ProductName;
Bound by Pescription of the product I guess

Dennis said:
Is the Unit Price field in your table called UnitPrice ?
Is the product ID text or numeric ?
The DLookUp function basically says, get me the Unit Price field from the
products table from the row where the productID matches the one I have
selected in the combo box.
Is your combo box bound on the ID or the description of the product ?
You need to check all these things and then provide the relevant info in the
DlookUp statement.

Evil_jay said:
That didn't work My products are in a table Called Products also the Unit
Price is there for the product the combo box on my form is called ProductID.
I tryed what you wrote and it gave me #name? in the field for unit price....

Dennis said:
Assuming your product information is in a table called Products and your
combo box is called cmbProduct set the control source property of your Unit
Price field to

=DLookUp("[UnitPrice]","Products","[ProductID] = '" & Me.cmbProduct & "'")

:

I'm not sure if we are on the same page(sry I may have explained it wrong) in
my product Id field (combo box) list all my products when i select a product
i want the amount of that product to auto post to my Unit Price field. The
expression i have already" Price=[UnitPrice]*[Quantity]" will already
Calculate my total once i input the Quantity needed. I just need to find out
how to make it work.... if you could tell me how to write the expression it
would help me out alot.
Thanks

:

The best way would be to make the product selectable from a combo box and put
all the other fields that you need as columns in the combo box. You can then
set the control source of the text fields on the form to

=ComboBoxName.Column(1)
=ComboBoxName.Column(2)

etc.

:

I have 4 Fields On a form Product Id(Shows a description of my product
instead of it's Id Number),Quantity,UnitPrice,Price. I need to find out how
to make all of this work together

When I select a Product id, i want it to auto find the UnitPrice so that all
i have to do is type in a #value in the Quantiy Field And have it calculate
my total price.


Can anyone help me i thin ki need a iF then Statement But not sure How to
set it up on access 2003
 
D

Dennis

This means your combo box has the Unit Price in it as a column. You can go
back to my original answer of setting the control source property of the Unit
Price field on your form to (assuming Unit Price is the third column in the
combo)
=[ProductID].[Column](2)

Evil_jay said:
Unit Price is Unit Price
Product Id :
Row Source :SELECT DISTINCTROW Products.* FROM Products ORDER BY
Products.ProductName;
Bound by Pescription of the product I guess

Dennis said:
Is the Unit Price field in your table called UnitPrice ?
Is the product ID text or numeric ?
The DLookUp function basically says, get me the Unit Price field from the
products table from the row where the productID matches the one I have
selected in the combo box.
Is your combo box bound on the ID or the description of the product ?
You need to check all these things and then provide the relevant info in the
DlookUp statement.

Evil_jay said:
That didn't work My products are in a table Called Products also the Unit
Price is there for the product the combo box on my form is called ProductID.
I tryed what you wrote and it gave me #name? in the field for unit price....

:

Assuming your product information is in a table called Products and your
combo box is called cmbProduct set the control source property of your Unit
Price field to

=DLookUp("[UnitPrice]","Products","[ProductID] = '" & Me.cmbProduct & "'")

:

I'm not sure if we are on the same page(sry I may have explained it wrong) in
my product Id field (combo box) list all my products when i select a product
i want the amount of that product to auto post to my Unit Price field. The
expression i have already" Price=[UnitPrice]*[Quantity]" will already
Calculate my total once i input the Quantity needed. I just need to find out
how to make it work.... if you could tell me how to write the expression it
would help me out alot.
Thanks

:

The best way would be to make the product selectable from a combo box and put
all the other fields that you need as columns in the combo box. You can then
set the control source of the text fields on the form to

=ComboBoxName.Column(1)
=ComboBoxName.Column(2)

etc.

:

I have 4 Fields On a form Product Id(Shows a description of my product
instead of it's Id Number),Quantity,UnitPrice,Price. I need to find out how
to make all of this work together

When I select a Product id, i want it to auto find the UnitPrice so that all
i have to do is type in a #value in the Quantiy Field And have it calculate
my total price.


Can anyone help me i thin ki need a iF then Statement But not sure How to
set it up on access 2003
 
J

Jose Aleman

Hi,

Have you tried pulling the information from a query?

Pull the information you need on the query and on an empty field write your
calculation. Price=[UnitPrice]*[Quantity]. Then you can create a form from
this query and create the ComboBox as the search field.


Evil_jay said:
Unit Price is Unit Price
Product Id :
Row Source :SELECT DISTINCTROW Products.* FROM Products ORDER BY
Products.ProductName;
Bound by Pescription of the product I guess

Dennis said:
Is the Unit Price field in your table called UnitPrice ?
Is the product ID text or numeric ?
The DLookUp function basically says, get me the Unit Price field from the
products table from the row where the productID matches the one I have
selected in the combo box.
Is your combo box bound on the ID or the description of the product ?
You need to check all these things and then provide the relevant info in the
DlookUp statement.

Evil_jay said:
That didn't work My products are in a table Called Products also the Unit
Price is there for the product the combo box on my form is called ProductID.
I tryed what you wrote and it gave me #name? in the field for unit price....

:

Assuming your product information is in a table called Products and your
combo box is called cmbProduct set the control source property of your Unit
Price field to

=DLookUp("[UnitPrice]","Products","[ProductID] = '" & Me.cmbProduct & "'")

:

I'm not sure if we are on the same page(sry I may have explained it wrong) in
my product Id field (combo box) list all my products when i select a product
i want the amount of that product to auto post to my Unit Price field. The
expression i have already" Price=[UnitPrice]*[Quantity]" will already
Calculate my total once i input the Quantity needed. I just need to find out
how to make it work.... if you could tell me how to write the expression it
would help me out alot.
Thanks

:

The best way would be to make the product selectable from a combo box and put
all the other fields that you need as columns in the combo box. You can then
set the control source of the text fields on the form to

=ComboBoxName.Column(1)
=ComboBoxName.Column(2)

etc.

:

I have 4 Fields On a form Product Id(Shows a description of my product
instead of it's Id Number),Quantity,UnitPrice,Price. I need to find out how
to make all of this work together

When I select a Product id, i want it to auto find the UnitPrice so that all
i have to do is type in a #value in the Quantiy Field And have it calculate
my total price.


Can anyone help me i thin ki need a iF then Statement But not sure How to
set it up on access 2003
 

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