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

Using the name of a field in a query

Status
Not open for further replies.

Mack2

Instructor
Mar 12, 2003
336
US
I have a field in a table called 2007 lls. I want to store the first 4 digits of the field (the 2007) as a value in a record. For example:
I am guessing in a query something like this;
field name: Year:2007lls
Records: 2007
2007
So I need to grab the 2007 and store is a a value. Any Ideas? THANKS
 
What about using the TableDefs object properties to delve into the properties of the table you want to look at?
 
I have never used tabledefs properties. How would I access them?
 
I have a field in a table called 2007 lls. I want to store the first 4 digits of the field (the 2007) as a value in a record.

Not at all clear about this.

The table name is "2007 lls"?
The field name is "2007 lls"?
The value stored in the field is "2007 lls"?

You want to
- Store it in the same table and record but a different field?
- Store it in some other table and field?
- Display it as a field in a query?
 
How are ya Mack2 . . .

A function to return the 1st four as numeric:
Code:
[blue]Public Function Get4(fldName As String) As Long
   Get4 = CLng(Left(fldName, 4))[/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top