Re: Getting Column Titles

From: das (das_at_discussions.microsoft.com)
Date: 12/03/04


Date: Fri, 3 Dec 2004 05:27:13 -0800

I was trying the following code but to no avail;
                    Dim pjCustomTaskText1 As String
                    Dim Task_Name As Long
                    
                    pjCustomTaskText1 = "pjCustomTaskText" & (i)
                    Task_Name = pjCustomTaskText1
                    xlRng = CustomFieldGetName(Task_Name)
I was hoping to use the Task_Name aas long and throw in the pjfield name.
Will this approach work at all?

Jeff

"John" wrote:

> In article <ZWPrd.157356$SM5.8852@news.easynews.com>,
> "Buster" <bubs@gmail.com> wrote:
>
> > I have tried the code you supplied, but have one question, why does it fail
> > when I substitute "pjCustomTaskText1" with "pjCustomTaskText&i)" where i is
> > the variable from the for next counter so that I loop through each of the 1
> > to 40 fields.
>
> Jeff,
> It fails because the argument in the CustomFieldGetName Method is a long
> and you are trying to use a string. There are various ways to handle
> this.
>
> One method that sometimes works is use the long numerical value. For
> example, use 188743731 instead of pjCustomTaskText1. This method works
> best if the numerical values for each of the fields of interest are
> sequential (or nearly so). Then increment the value to the next field.
> Note that the difference isn't always "1" and there may be breaks in the
> sequence so those will have to be addressed. Another downside is that by
> using the numerical value, it is not obvious which field is being
> addressed.
>
> Another method that works is to set up a case statement to change the
> long constant each run through the loop. Yes it is a lot of case
> statements but it gets the job done.
>
> Hope this helps.
> John
>



Relevant Pages

  • Re: (Tournament venue change) Sympathetic Agony: Atlanta - Saturday November 17 - Change of
    ... Robyn: Fat Torries with some Grand ball/voting going on. ... Jeff dual forms up some guys, ... John tosses some poison pills about. ... John dances into Jeff a bit, doesn't quite oust. ...
    (rec.games.trading-cards.jyhad)
  • Re: Challenge for Ken Shackleton
    ... Biological evolution is not simply one sequence of letters randomly ... Biology has mechanisms to hop across gaps in the sequence ... You fail to understand that large scale changes can be ... understand that the large evolutionary changes that we talk about have ...
    (talk.origins)
  • Re: Beatles myths
    ... Jeff wrote: ... music that I do know something about their marriage. ... In a sense John ... His drug use is pure speculation on your ...
    (rec.music.beatles)
  • Re: how to scramble data in a table
    ... gaps in the sequence. ... Person record and then select 3 random PersonID using the RAND ... things like "John Paul Depfarb" or worse. ...
    (microsoft.public.sqlserver.programming)
  • Re: dates in table 2 fields need to be one field I can sort by dat
    ... John and Jeff, ... Thanks for your help the date serial in an update query took care of the ... display as text but can't seem to get them reconized as a date for sorting ...
    (microsoft.public.access.queries)