Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controls -Vs- Values

Status
Not open for further replies.

cranebill

IS-IT--Management
Jan 4, 2002
1,113
US
I have a question that should be pretty easy. Here is Sample Code.

Dim Sample as String

Sample = Forms!SampleForm.SampleControl

Ok now for the question. How would i get Sample to equal the value of the control instead of the control itself?
I am asking for an example fo if the value was text, and another example if the value was numeric. Any help would be graetly appreciated.

Bill
 
Use the .Value property on the control you are referencing. For example:

Sample = Forms!SampleForm.SampleControl.Value

Hopefully this should help you.

cope22
 
How bout this... I get an Object Required error

CusNo = Me.Customer.Column(1).Value

This is the sql for that control:

SELECT DISTINCT Customers.CompanyName, Customers.[Customer Number] FROM Customers INNER JOIN Quotes ON Customers.[Customer Number]=Quotes.[Customer Number] WHERE (((Quotes.Status)=Forms!ViewQuotes!Status)) ORDER BY Customers.CompanyName;

Is there something different i have to do in this particular instance?

Bill
 
If you are just trying to reference the value that has been chosen in the combo box, do this:

CusNo = Me.Customer.Value

You could possibly do the same with the following:

CusNo = Me.Customer.Column(0)
(leave out the .Value in this case)

Basically, if you only have one column in your combo box, the above code does essentially the same thing (I would use the first example in this case). I would use the second example IF you had more than one column, and wanted to specify which column you wanted to reference.

Hope this makes sense.

cope22
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top