Assistance needed in Dlookup

Voyager

Registered User.
Local time
Today, 05:01
Joined
Sep 7, 2017
Messages
95
Hi Team,
Currently I am using this code to dlookup Taskname which was working fine.

DLookup("taskname", "workdata", "empname = '" & forms!dailydata!Name & "'")

Now I am starting to get multiple names separated using semicolon in the form field"Name" if there are multiple names the dlookup is not working since there is a semicolon

I tried using LIKE and * in Dlookup but its not working too

I there are two usernames usr1;usr2 I need results in a similar fashion separated using a semicolon as taskname1; taskname2 is it possible? Could you assist?
 
If you have 2 or more tasknames in a single table field, I suggest you have a design issue.
However, please tell us more about your tables and relationships.
 
Hi jdraw,
If a task is being shared by two or more employees this situation occurs. The username is the recipient names of outlook mail.
Basically the workdata table gets input from email recipient list.
 
Hmmm? If 2 employees or more were working on same task, I would expect 2 or more records identifying each employee and task.
eg in overview
Bob Task1
Jim Task1
Sam Task1
And from that take each name and concatenate with ";" as email recipient

SendTo Bobsemail;jimsemail;samsemail

but you may have set it up and have processes to do it differently.
 
I there are two usernames usr1;usr2 I need results in a similar fashion separated using a semicolon as taskname1; taskname2 is it possible? Could you assist?

As JDraw pointed out, you have a "Many to One" relationship between employees and a task. I am guessing you also have a table of employees, so this becomes a "Many to Many" relationship where you use a table to join employees to tasks.

Not horribly difficult to set up.

Do a couple searches for "Many to Many relationships" and you should find a set of examples.

You have found one of the reasons you set up databases up this way. While it may not be the norm, as soon as you have a "Can have more than one of" you need to design for it.
 
I have a code that downloads recipients of outlook sent items folder into the db. The taskname field is unique value so I could not add the task name field.
Only option I have is to add recipient list to the field next to taskid field.
 
If you only want to find the task name, and the number of people working on it doesn't matter, then you could use "split" on ";" to get an employee number then dlookup on that, or if you need to do it for each person, then do the same and loop through the array for each one.
 

Users who are viewing this thread

Back
Top Bottom