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

Splitting Data

Status
Not open for further replies.

bdmoran

MIS
Nov 7, 2011
87
0
0
US
Hello - There is a column in one of my tables in access that has an employee name and employee ID formatted like this:

Smith, Mike [567891012]
Pike, Tim [9898]

I am looking to get the employee number in a seperate column. I was thinking to create a query with the
function, but every employee ID is a different number.

any ideas? Thanks!​
 
Thanks. I never heard of that, but A2k seemed like it was short lived. I think I went straight from 97 to 2003. I have seen where all the string functions stop working due to a reference issue to the vba library. Often noticed first in a query, but systemic to the project.
One thing I have seen is performance issues between the inline function or the same function wrapped. I have never heard this discussed in query performance. I use to try to always write the UDF because you could error check and make the SQL a lot cleaner. Then I noticed the exact same function written inline was orders of magnitude faster than the same function wrapped in a UDF. Ever seen this?
 
I never heard of that
Do a google search for jetsql sandbox
 
Maj P - this works great, thanks! Only question I have is how come when I call for the "Employee Name" Field on my report, it prompts me to enter in a value. Where as before when I didn't use your function it just synced the data.
 
dbmoran,
If you are prompted for a value it typically means you have something in your report bound to a name that isn't in your report's record source. Check your record source and check all of your control sources and sorting/grouping.

Duane
Hook'D on Access
MS Access MVP
 
PHV, I did not think about Sandbox. Thanks.
 
I have other fields in my report that are working perfectly. Would it have something to do with the function??
 
Provide your SQL statement of your report's record source as well as the prompted names. We can't fix what we can't see. Do you have a field/column [employee name]?

Duane
Hook'D on Access
MS Access MVP
 
SELECT RemoveEmployeeNumber([Employee]) AS [Employee Name], Timesheet.Date, Timesheet.[IN Time], Timesheet.[OUT Time], Format([IN time]-[OUT time],"short time") AS Actual, IIf([Reg hrs] Between 3 And 4,4,Roundtime([Actual])) AS Regular
FROM Timesheet
WHERE (((Timesheet.Date) Between [Start Date] And [End Date]));


On my report I am looking to pull [Employee Name] but it's asking me for a parameter. I have the [Actual] column on my report and it works just fine.
 
Still no luck. I just deleted the field entirely and it is still prompting me for a parameter. This didn't happen until I added the function RemoveEmployeeNumber() to my query
 
It WAS a grouping and sorting error. What I did was re-select Employee Name in the dropdown and it worked magic.

This website has been very helpful to me. Thanks everyone for your help and support!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top