473,386 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Hope someone can help me here...

2
Hello,

I am a novice user of Access 2003 and have myself up to my ears in a problem.

I have a table with a field in it (call it dept_code for arguments sake) that stores numerical values separated with a comma in one table. The values its storing are the depts that the managers in that table are responsible for looking after. I have been able to get the values loaded into the field (as a string) using the fieldcontents + "," + variable1 format method with each addition adding to the existing value in the field, a comma and then another dept code (2 digits).

The table also stores user information for login and is separate from the table that stores the core employee info they will be working with.

The other or (main) table contains records for every employee in the company with various details. I have been trying to figure out how to get access to read the dept codes separated by commas from the managers table and then using it to present only those records that match the dept code from the employees table.

The problem is sort of two fold, one how to I get access to read that "string" and see it as several dept codes and then compare them to the main table and show only the records that have matching dept codes?

I have tried using filters in a number of ways, however using a filter allows users to simply click unfilter to gain access to all records, and prevents them from using their own filters.

From what I have been able to gather I need to use some sort of select/where/in statement.

SELECT Main_data_Table.*
FROM Main_data_Table
WHERE Main_data_table.[Cost Centre Number]
In (SELECT [resp_cc] FROM Security WHERE Security.[emp_num] = [cur_emp_id]);

resp_cc is a global variable defined as a string
cur_emp_id is also global but is an integer


This example is as close as I got but still does not read or work properly whether I insert it into code or use it as an SQL query.
I apologise in advance if my terminology or question is incorrectly worded or formatted however I am a novice user and although I did development in college its been over 10 years since I used any of it, so I am kinda out of date.

Any help with this would be mucho appreciated since I am on a time critical project that needs completion soon and until I figure this out I cant move much beyond it. Thanks in advance to everyone for your help.

Regards,

Mugs
Sep 11 '06 #1
2 1543
MMcCarthy
14,534 Expert Mod 8TB
Take the department code out of the table where it is currently stored. Create a new 'Join' table, containing dept_code and emp_num. Make them a joint primary key. and add one department code per employee number. (e.g. Employee Number 215 and department code 12, Employee Number 216 and department code 14, etc.)

BTW: Don't use + sign to concatenate strings in VBA use &.
& "," &

Hello,

I am a novice user of Access 2003 and have myself up to my ears in a problem.

I have a table with a field in it (call it dept_code for arguments sake) that stores numerical values separated with a comma in one table. The values its storing are the depts that the managers in that table are responsible for looking after. I have been able to get the values loaded into the field (as a string) using the fieldcontents + "," + variable1 format method with each addition adding to the existing value in the field, a comma and then another dept code (2 digits).

The table also stores user information for login and is separate from the table that stores the core employee info they will be working with.

The other or (main) table contains records for every employee in the company with various details. I have been trying to figure out how to get access to read the dept codes separated by commas from the managers table and then using it to present only those records that match the dept code from the employees table.

The problem is sort of two fold, one how to I get access to read that "string" and see it as several dept codes and then compare them to the main table and show only the records that have matching dept codes?

I have tried using filters in a number of ways, however using a filter allows users to simply click unfilter to gain access to all records, and prevents them from using their own filters.

From what I have been able to gather I need to use some sort of select/where/in statement.

SELECT Main_data_Table.*
FROM Main_data_Table
WHERE Main_data_table.[Cost Centre Number]
In (SELECT [resp_cc] FROM Security WHERE Security.[emp_num] = [cur_emp_id]);

resp_cc is a global variable defined as a string
cur_emp_id is also global but is an integer


This example is as close as I got but still does not read or work properly whether I insert it into code or use it as an SQL query.
I apologise in advance if my terminology or question is incorrectly worded or formatted however I am a novice user and although I did development in college its been over 10 years since I used any of it, so I am kinda out of date.

Any help with this would be mucho appreciated since I am on a time critical project that needs completion soon and until I figure this out I cant move much beyond it. Thanks in advance to everyone for your help.

Regards,

Mugs
Sep 11 '06 #2
Mugs
2
Take the department code out of the table where it is currently stored. Create a new 'Join' table, containing dept_code and emp_num. Make them a joint primary key. and add one department code per employee number. (e.g. Employee Number 215 and department code 12, Employee Number 216 and department code 14, etc.)

BTW: Don't use + sign to concatenate strings in VBA use &.
& "," &

Thanks for the help. I managed to find a different solution during the evening and so have not been able to implement this one yet. Having said that, I will try these suggestions as well and see if that works. I appreciate the response and the value of this site and its members, novices like myself would be lost without these sorts of resources.
Sep 12 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: What-a-Tool | last post by:
I'm going out out of my mind trying to get this to work with no luck. The error message I get is at the bottom. Can someone please tell me what I'm doing wrong here. I've tried this a million...
8
by: Sue | last post by:
Hello! I am back with another question. Remember I am a new JavaScript student and I am aware that this code does not check for all the possibilities and that as a "NEW" JavaScript student I am...
1
by: BJS | last post by:
Sorry for the cross-posting, but based on the number of people I have seen ask for a solution to this problem, I hope by cross-posting this, that it will help a lot of people out of a common...
1
by: sparks | last post by:
I have done a LOT of databases in access 97 but I am new to access 2000. We are S L O W L Y converting over. Yesterday I had a 97 database that I had to run the converter to 2000 and everything...
6
by: wooks | last post by:
Sorry if this is very basic. I have bought a Functional Programming book that uses the language Hope. I have managed to locate and extract Ross Pattersons hope interpreter from...
3
by: Marek | last post by:
Hello gurus! I wrote a code in VBS, that will check, that current user is in one from three groups. But i don't know how asimilate it with asp.net. This page will be a bridge between 2 - main...
12
by: garyusenet | last post by:
I have had no replies to my previous post so perhaps I didn't write it good enough. Please excuse new thread but i wanted to break from the last thread hopefully this thread will be better. ...
0
WebMissy
by: WebMissy | last post by:
I have a forum all set up and everything works great. I decide to use IE 7 for the benefit of transparent PNG files. All is well with that but now my scripting for my colored scrollbars doesn't...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.