I am trying to build a custom list where I have people's names and email addresses in two different columns. Since I'm hooked up the the active directory, I would like to select the person's name from the AD and then have their email address automatically populate in another column.
The only way I have figured out to do this is to find the person's name twice in the active directory, first in the "Name" column and secondly in the "Email" column (which is formatted to show the person's email). Can I do this with only having to enter the data in once. It would be so much easier since I have to add hundreds of names to the list.
Also, and this is probably a little bit harder, the title of the row is the person's name and right now I have to manually enter it, but can it be automatically populated based on the people picker name selected from the AD?
Dave
Related
I currently have these options set in a combo box:
This box will show the projectIDs that a current company has which is set with the criteria. I just want to show the name of the project as people will not know just by the id. If I remove the check box for the projectID it will just remove that field completly and not show anything. I have debugged what companyBox.Value is and it is indeed a number for a company and if taken this id and replaced it with the following query which is built from the picture and it returns the results I want. I just cant get the values to show in the combo box.
SELECT projects.projectName
FROM companys INNER JOIN projects ON companys.companyID = projects.companyID
WHERE (((companys.companyID)=7));
Gives me all the projectNames where the companyID is 7
And as seen below that same query just gives me blank spaces instead of the names:
Ok, if you have say a query, then as noted, then you can use a "join" to pull in the other table (based on that "projectID").
So, for a general report etc., then your approach of using the query you have is correct.
HOWEVER!!!
For a combo box? They have this feature and ability built in. In other words you do NOT in general need a join.
The combo box has two parts:
A sql query that "drives" or "fills" the combo box. This can (and will be) of course based on the Projects table.
VERY important:
Our combo box is to save, store, put, use the project ID into a column in our CURRENT form. That form of course is based on a differnt table (the forms current table). So, keep in mind the two concpets:
Combo box can be driven by any table to display data.
Combo box will/can use a column from that "other" table to SAVE into a current column on the current form.
Now of course the Project "id" is the VALUE we want, but we sure as don't want to display that "project id" value, since as you note, humans want the nice looking text.
First Rule:
ALWAYS, but ALWAYS make sure the FIRST column of the combo box "sql query" is the column we WANT to save into the current form, but ALSO the column we are going to HIDE AND NOT show to the user.
So, a combo box can with great ease HIDE the first column. You can hide other columns, but as a general rule a VERY HIGH number of my combo boxs will have two columns. So, you might need company "id", but would want to display company name as nice text to the user, but store/save/use the "id" of company for this purpose.
So, in your case? Change the order of your columns.
You want:
ProjectID, ProjectName, and you ALSO can continue to have a filter based on company.
So, once you get above setup, and you WILL NOT need a sql join. Remember, the combo box has it own "whole sql statement" based on table projects.
So, the combo box will:
Save/store/use the ProjectID when you select a project.
And it will display the project name, but behind the scenes it will use + save ProjectID.
So, just make sure that you set the length of the first column in the combo box to 0 (to hide that projectID from display).
Next, make sure you set WHICH column value from the query the combo box is to save.
That column will be the FIRST column, so you want to set that to 1
Your combo settings will look something like this:
In above, the CONTROL source is your CURRENT form and table.
So, I want to get a Hotel "ID" from the table hotels, but I am going to save the results of the combo box selection INTO a column called Hotel_ID
And note VERY careful - I set the bound column = 1 (that is the FIRST value from the query that drives the combo box.
Next up:
We want to hide the first column value, so you need this setting in format tab of the property sheet for the combo box:
NOTE VERY close in above. I set the FIRST column width = 0. this is HOW you hide the "ID" of hotels - I only want the user to see the nice hotel name. (or in your case Project name).
But, the 2nd column, I have a width for the Hotel name (or in your case project name).
So, make your first column in the query for the combo box the "id" of project id. Set the width of the first column = 0.
So, the query that drives the combo box? It is based on the ONE table, but you need to ensure that the "id" that you going to use is the first column, and simple hide it from display.
So, a combo box has a sql query that drives the combo box, and that query in most cases will NOT be the current table.
So, you have to set BOTH settings (the column the combo sql query will use - but to avoid confusing, then just adopt the habit of making the 1st column the "id" or value you want from that sql.
But, after setting above, you STILL have to set what column to shove/put that column into on the current form. (that setting is the control source).
In effect, a combo box is a kind of look-up into the other table, and it can display nice user friendly text columns, but still use + store the ID.
So, your query should look more like this:
SELECT ID, projectName
FROM projects
WHERE (((companys.companyID)=7));
I don't know if your first column of Projects table is "ID" (or is it ProjectID), but as you can see, the combo box ONLY needs to be based on the one table, and with our new rule - we always use the first column of the query the "id" value we want.
Now, of course the above is "hard coded" for company, and your original query that drives the combo box was fine - just that the order of the columns display was incorrect.
I have a form where I would like to include a search function. Optimally this would include a combo box where the user can select their Search Field, i.e. Name, SSN, etc. and a text box to retrieve input.
There will be two tables I'd like the information to pulled from. So I assume I'll need two subforms, each with a query for that table. Is there a way to tie in the combo and text boxes to both of these queries at once?
My ultimate goal is to allow users to search for a record (an address), which may be in one of two tables, then select that record and have it appended to a third table which will be a separate subform.
This is basically my solution to relating addresses with people to reduce the amount of typing necessary.
I'm using a linked view in Access from the SQL server.
That view contains an employee_name column and many other columns (like equipment , parking, room, date etc). There is a row for each new entry (for example an employee got a new phone at a date and then at another date he got another phone), therefore there are multiple rows for the same employee name.
What I need to achieve is having all the entries in a form from an employee.
What I have tried so far is creating a form based on that view and adding a combobox with the option "find a record on my form based on the value I selected in my combo box active". The problem was that I was seeing users multiple times due to the new enteries mentioned above. I fixed this by doing a select distinct on the employee name in the row source tab.
But now I'm getting only the first entry for an user, what I want is to get all the enteries (maybe in auto-generated textboxes, or anything which will be easy to export to excel, since that would be my next step - to have a button which can generate a report based on the user with all the corresponding entries) like I would have written SQL code like below:
select * from schemaName.viewName
where employee_name = '/*here use the selected name in the combobox'
Thank you for your help, I am a complete beginner to forms in Access and all of these great things one can achieve.
I wish that I had a more precisely descriptive title for this question, but I am not very knowledgeable with Excel spreadsheets or VBA (I'm primarily a Java developer, and don't play much in the Microsoft world).
I'm trying to use an Excel spreadsheet to accomplish something. I need to determine whether I can get there with a PivotTable, PivotChart, or some other built-in functionality... or whether I need to go down the path of writing custom VBA code (or maybe using another platform altogether).
The purpose of the spreadsheet is to help create schedules for an organization (a Toastmasters club). This organization has a roster of members, it meets weekly, and various members are assigned to various roles in a given meeting.
My spreadsheet looks like this:
First Tab
One column... a list of names representing the membership roster.
Second Tab
Each row represents a past meeting date. There are columns for each role, and the cells are to be populated with who served that role on that date. I use Data Validation to have the first tab's roster available inside each cell as a pulldown.
Third Tab (maybe multiple tabs?)
Here's the point of the whole thing. For each of the possible meeting roles, I would like to see which members are the most "overdue" to be assigned for that role. Basically, I want a list of all the club members, sorted in order of how long it's been since they last served that role. People who have never served in that role would be sorted at the top of the list.
Is that third tab data something that can be accomplished with a PivotTable, etc... or am I misunderstanding the purposes and limitations of those tools?
I found a way you can do this with pivot tableS - one per role. It's a bit dubious whether you should, but depends how many roles you have really. I made it work using 2 as a sample, here's the gist:
You have an (Excel) table containing Names
You have an (Excel) table containing Meeting Date, RoleA, RoleB... (I used Chair and Secretary as nominal examples), these cells contain the name of the person taking that role
You then create a Pivot Table for each role (Insert --> Pivot Table). The fields to use are: Row Labels - whichever role you're analysing; Values - Meeting Date
You then change the result type by going into Field Settings, and change it to Minimum. Note that only people who have had that role will show up here.
Repeat this for each role.
Go back to your table of names, and add a column for each role to show when they last held the role. The formula for this is the rather unwieldy:
=IFERROR(GETPIVOTDATA("Meeting Date",Chair!$A$3,"Chair",People[[#This Row],[Name]]),0)
The GETPIVOTDATA will error if they haven't had that role, so I'm replacing errors with 0 (an arbitrary low number)
You can then identify the person most overdue for the role using:
=OFFSET(People[[#Headers],[Name]],MATCH(MIN(People[LastChair]),People[LastChair],0),0)
If there is a tie, the person who appears first in your list of names will be given here.
Hope that makes some semblance of sense, ask away if any questions
My first instinct is to move you to Access where you can SQL query to your heart's content, but I'm sure this can be done in Access without any custom coding.
PivotTables may work, but I avoid them for several reasons (hard to describe to casual users, doesn't update automatically, hard to format, etc.), so here is something using just Excel's built-in cell functions.
Check out vlookup() and countif() on http://www.techonthenet.com/excel/formulas/index.php. (The built-in help files work too. I just like this site more)
In the image below, I have simulated your Tab2 and Tab3. Tab2 is purely data with no equations. Vlookup() requires that this table be sorted by Date Descending and with the date column on the far right.
Tab3 counts both the # times each person has served in that role and when they last worked that position.
The formula in cell C13 is =COUNTIF($B3:$B8,$B13). i.e. it counts the number of times that "Abe" appears in the Chairperson column of Tab2.
The formula in cell D13 is =IF(C13>0,VLOOKUP($B13,$B$2:$D$8,3,FALSE),"-"). i.e. if that person ever served in that role, then it finds the most recent date.
The formulas for security are almost the same. The "Last Served" column is now =IF(E13>0,VLOOKUP($B13,$C$2:$D$8,2,FALSE),"-"). The ranges need to be renamed here to satisfy the needs of the Vlookup function (a SQL query would be really convenient here, but Excel doesn't allow that)
It's hard to define if someone is 'overdue' because some people will argue that "Last Served" is more important than the "# Times Served" and others will argue the exact opposite. I suggest looking at both columns and just talking it over.
So I have a document with many entries that follow this general format.
Organization Name Title Address Phone Fax
Description line 1
Description line 2
Organization's website.
Organization Name Title Address Phone Fax
Description line 1
Description line 2
Organization's website.
Organization Name Title Address Phone Fax
Description line 1
Description line 2
Organization's website.
What I want to do is to sort them by organization and treat the first rows as one entry so excel essentially thinks:
Organization Name Title Address Phone Fax
Description line 1
Description line 2
Organization's website.
is one row. I should also add that the bottom 3 rows are merged across the cells that form the row above them. Essentially I need it to work as a database but for government workers who are so technically unsavvy they can't upgrade to Office 2007 because the whole ribbon thing is "too confusing." So I am stuck using Excel 2002. I need to be able to sort them and use the top few rows above the actual chart to include a header and sub-heading.
Do you need the description/website rows to remain merged? If not unmerge to make it easier. You've tagged it as VBA but if this is a one-time fix then is it OK to manually work on the sheet?
As a starting point I would suggest adding an identifier to each group of rows, and depending on your data quality you could do this by checking the website cell, or simply by counting rows. For example, you could insert a new column before your data and put the following in cell A2:
=IF(Left(Lower(B1),4)="http",B2,A1)
Where B1 (the row above) could be Organization, Description 1, Description 2, Organization's website, and if it is a website, we assume that on this new row we're starting with a new block of data so we'll take the organization name. If it isn't a website, we'll use the organization name we were using previously (A1 will need to =B1). Then copy that formula down until the end and the 4 rows will at least now have a common key which you can then use to mash around the data.
If there are URLs which just start www. then modify the formula or better, just search/replace "www." to be "http://www." so that your data quality has improved.
Can't you just try recording a macro daoing whatver sort operation you want using UI, and then alanyze the code, and get an idea of what you need to do?