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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Val Function in queries

Status
Not open for further replies.

DaveShmave

Programmer
Dec 30, 2000
40
US
I was wondering if there's a way to use the Val function in a query.

I have been messing around for a while and was wondering if it's even possible.

I want to return an ID number from a field that's a combo box. The ID number is hidden in the combo box (Column Width = 0), but two other fields are not. s-)

TIA

Dave
 
I am probably confused by your use of the word query so I'll answer it twice.

To get the numeric value of a text field in the record using a query: In the 'Field' section of the query builder this would return the numeric value of a text field in the record called TextFieldInRecord.

ShowNumericValue:Val(TextFieldInRecord)

To get the numeric value of a column of data in a combobox:

Dim lValue As Long
lValue = Me.ComboBox1.Column(1)


Steve King
 
Hi Steve,

I need to clarify, sorry.

I have a field in a table called, say Part. This field is a combo box essentially consisting of three fields: PartID (Hidden), PartNumber, and PartName.

In a separate query, I'd like to return the PartID field using the Val Function if possible.

I tried a form of what you listed above but that didn't quite work. X-)

Any other ideas?

Thanks,

Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top