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

Row Numbers 1

Status
Not open for further replies.

migv1

Technical User
Apr 23, 2004
39
0
0
US
How do you return the row number (or ID number) of a task based on the value of a text string in a particular column (e.g., Text9)?
I need to refer to particular tasks based on the indicator field values for use in a LinkTasksEdit command.
Thanks in advance for any help.
 
Your question doesn't make it clear what is in text9.

val(somefield) returns the numeric value in somefield.

Perhaps you could give us the error message you're getting.

Better yet, give us the source data, the results you're getting and the results you expected to get.
 
Sorry if the question was unclear - I basically need to get the row or ID number of a task if a particular text string is present in the text9 field of that row. No error involved here; the text9 field will be searched for the text string using a for-next loop in VBA and I need the row number or ID of the task the containing the found cell. The row number or ID would then be used for establishing links using the LinkTasksEdit command. The contents of text9 will be preset for specific tasks in a template, and these will be the basis for creating links (using VBA) in a consolidated master project file.
 
Okay, I understand some (but still not all).

First of all, although it looks like it, there are no such things as row numbers. The ID number is a near-perfect (not *perfect* -- just near-perfect) substitute. If you are displaying the Project Summary Task then you will note that the first row is row 0. In fact, that row is inaccessible and the second row, task ID 1, is the first that is accessible.

So ... references are not to Row but to ID.

Now for the part I do not understand. Does text9 contain the TaskID that it is to link to ... or the name of the task that it is to link to (in which case, you have to do a search trying to match text9 to the name).

Help me out a little more: what is in text9?
 
Text9 would have, where appropriate, an identifier for tasks that would link to other tasks. For example, it could contain the text "Proj1>Proj2" to indicate that this task in Proj1 would link to a task in Proj2. I just need to get the ID of the tasks that have the identifiers in text9.
 
This answer is so obvious that I *must* be missing something in your requirements:

dim tt as task
dim intID as integer
for each tt in activeproject.tasks
if tt.text9 = "proj1>proj2" then
intID = tt.ID
end if
next



 
Thanks for the info, PDQBach. Basically, I'm trying to re-establish links between tasks in embedded subprojects in a consolidated master file by using the LinkTasksEdit method (from Project VBA Help):

LinkTasksEdit(From, To, Delete, Type, Lag, PredecessorProjectName, SuccessorProjectName)

My problem lies with the following:

From - Required Long. The identification number of a predecessor task.

To - Required Long. The identification number of a successor task.

I tried using ID and UniqueID for these parameters, but the results have been unpredictable - links were set between the wrong tasks, desired links were not set, etc.

What exactly is meant by "identification number" in this context? I've looked all over - there's a lot of info for Excel, Access, and Word VBA, but next to nothing on Project VBA. Any and all help is greatly appreciated.
 
OK ... let's look some additional possiblities.

First off, you probably should visit this url:

Although it will lead you to a file about P98 VBA, the *vast* *vast* majority of the info is still relevant to P2000+. So, go to the url, download the exe and run it to generate the half-dozen or so files of documentation.

(The description of LinkTasksEdit appears to be the same in both the online VBA help file and in the P98 documentation you'll download at the url above. If it is, then the downloaded documentation might not help you much in this particular situation but you may find it useful later on in different circumstances.)

As to your specific problem, I think "identification number" and ID (as in task ID or tt.ID in my example above) are the same -- but I'm doing some other playing around to see if I find anything different.

Since the LinkTasksEdit routine needs longs, I'd change the sample code above and work with lngID (see below). It's always possible to coerce the integer to a long in the call to LinkTasksEdit but I'd force the change during the assignment and then use the long field in the call.

dim tt as task
dim intID as integer
dim lngID as long
for each tt in activeproject.tasks
if tt.text9 = "proj1>proj2" then
intID = tt.ID
lngID = intID
.
.
.
end if
next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top