Lookup a value in a table and display text if a value exists

I have a customer database form named frmMain with a field called txtAgency.

I also have a table that has a column of agency codes that are in the 
Outlook Global directory. The table is called tbl_Global and consist of about 
40 records.

If the user inputs an agency that is within this table on the frmMain, I 
want the phone number field (txtPhone) on the database form to automatically 
display "See Outlook".  If the agency is not within this list, I want the end 
user to be able input a value on the form.

What is the best way to go about this?
0
Utf
12/23/2009 3:19:01 AM
access.modulesdaovba 1670 articles. 0 followers. Follow

1 Replies
1127 Views

Similar Articles

[PageSpeed] 26

Use DLookup() to get the phone number of the selected agency.

See:
    http://allenbrowne.com/casu-07.html

-- 
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"Tim Gallivan" <TimGallivan@discussions.microsoft.com> wrote in message 
news:7696C496-680E-4143-928F-91B6D8613459@microsoft.com...
> I have a customer database form named frmMain with a field called 
> txtAgency.
>
> I also have a table that has a column of agency codes that are in the
> Outlook Global directory. The table is called tbl_Global and consist of 
> about
> 40 records.
>
> If the user inputs an agency that is within this table on the frmMain, I
> want the phone number field (txtPhone) on the database form to 
> automatically
> display "See Outlook".  If the agency is not within this list, I want the 
> end
> user to be able input a value on the form.
>
> What is the best way to go about this? 

0
Allen
12/23/2009 8:07:44 AM
Reply:

Similar Artilces:

Pivotable
Is there a method of hiding zero values automatically in pivot tables? Thanks. Double click the field header Uncheck "Show items with no data -- Message posted from http://www.ExcelForum.com Thanks for your response. I have followed your instructions but the zero values remain in the report. Any other ideas. >-----Original Message----- >Double click the field header >Uncheck "Show items with no data" > > >--- >Message posted from http://www.ExcelForum.com/ > >. > ...

Offline Terminal DataBase & Custom Table
Hello, I use the terminal database offline withe my POS (rms 1.3R). I create my database with Pos administrator, specifie the server for offline database. When I generate Z report , the database synchronize items and customers. But my problem is : I have a custom Table with Price connected to the Item's table, and this table doesn't synchronize with the offline database. Is it a solution to my problem ? or a tips ? Thanks Sorry for my english. Math ...

Is it possible to display text in charts?
I am creating graphs for results from a survey. Part of this is to graph each individual's response to every question. If a person did not answer a question, I would like "N/A" to appear in the data for the chart. I am not using formulas -- the numbers are typed directly into the spreadsheet. Is there any way to have the text "N/A" display in the chart data? Currently, if I enter text in the corresponding cell, it displays as "0" in the chart data. Thanks! Janine, You can try applying a custom format to those entries that are coming across as zero....

Identifying the top five values in multiple groups
I've got a spreadsheet of pay information for about eight hundred people. Each person is on one of eight salary scales I'd like to create a new worksheet that shows the details of just the 5 highest paid people in each scale (name, dept, salary, etc.) - and also the five lowest. Ideally, I'd like also to be able to vary that number - eg the top ten, the highest, etc.. Can someone help? Thanks Suppose you have data in Sheet1 in the below format Col A Col B Col C Name Scale Salary a1 1 101 a2 1 102 a3 1 103 a4 2 104 In Sheet2 cel...

Table relationships and lookups
Hi guys, I may be a little over my head, I've had some experience in creating simple access db's. however this one will be extremely complicated as far as I can tell. Some backround info - i've got an excel spreadsheet currently that i would like to convert to Access. The spreadsheet does multiple lookups and calucations. This is for a Soccer club that i run to maintain roster information, dollars, scheduling and stats. I'm currently working on the scheduling pience. Here's what I have so far. tables. Club - Lists the teams in the club, home field name and ...

File handle in global value
I open a file in one thread, save the file handle in a global value(ignoring for a moment that its not recommended), then close the thread , open a new thread and use the handle inside it to access the file and finally close the file in this thread. Is it legal from the point of view of C++/MFC(again,ignoring for a moment that its not recommended)? Regards Mandi >I open a file in one thread, save the file handle in a global value(ignoring >for a moment that its not recommended), then close the thread , open a new >thread and use the handle inside it to access the file and f...

Invoice lookup by paid check number
I frequently have vendors call me asking for information about what invoices were paid by a check number. Is ther an easy way to look this information up? -- Rodger You could go to Inquiry>Purchasing>Transactions by Document, put your check number in the 'from' and 'to' fields. Once the document is displayed in the scrolling window zoom back on the 'Unapplied Amount' field. Viola! the documents paid by the selected payment are listed. Unfortunately there isn't a print icon on this inquiry window, but I think it's the information you wanted. &quo...

Problem with Null value elimintation criteria
Access 2007 on Vista. I'm building a simple append query to add missing records to a table. It examines a list of entries, identifies which are not in the destination table, and adds them. Simple thus far. The problem comes when I add a criteria to the source side to ensure no blank entries are appended. Here's the SQL I'm trying to use: INSERT INTO tblAgents ( AgentID, AgentName ) SELECT qryAgentsImport.RecAgentID, First(qryAgentsImport.RecAgentName) AS FirstOfRecAgentName FROM tblAgents RIGHT JOIN qryAgentsImport ON tblAgents.AgentID = qryAgent...

Two tables, one query, one form, one problem
Hello all: I have two tables (one with employee data and one with Office location data). They are joined using the office address as the primary key in the Office Table and the foreign key in the Employee Table. I have created a query using all of the fields in each table. Here is what I want to be able to do (and can't seem to): Enter in new employee data and (with a combo box) select the address of the office and have it populate the rest of the office information. When I try it, it doesn't work. I have created a query with the addresses and bound it to the combo box. ...

how to create 0 to 0 value charts
how can i create a chart that for the values that start say for example from 0 for a speed of 1000 and then revolve through different values of speed. these values values when plotted initially start from 0 for 1000 and reach a highest value at say 4000 and return back to 0 at 1000 speed. say that values if they look like these, 1000 0 1400 7 1500 680000 1800 0 2000 650000 2500 660000 3000 750000 3100 800000 3400 0 3500 0 3700 0 3800 0 4000 0 4300 0 4500 0 5000 0 5300 0 5500 0 5700 0 6000 0 6000 0 5700 0 5500 0 5300 0 5000 0 4500 0 4300 0 4000 0 3800 0 3700 0 3500 0 3400 0 3100 0 3000 8500...

Lookup
Q103 Q102 Q202 Q302 Q402 Q103 Q203 How can I lookup the Q103 in the row above and then have it pull the number to the right one cell (Q203)? thanks If I understand correctly =INDEX(A2:F2,MATCH(A1,A2:F2,0)+1) where q103 is in a1 and q102-q203 is in a2-f2 Lance >-----Original Message----- >Q103 > > >Q102 Q202 Q302 Q402 Q103 Q203 > > >How can I lookup the Q103 in the row above and then have >it pull the number to the right one cell (Q203)? thanks >. > matt wrote: > Q103 > > > Q102 Q202 Q302 Q402 Q...

change color in many text box
I have a form which takes information from a query. The information is orizontally aranged in the many text boxes . I would like to know how can i change the background color of the text box on the row by just doubleclicking on that particular row. Give me some suggestions please! ANY IDEEA, "florin" <florin_serban@hotmail.com> wrote in message news:ercv$ytcIHA.5164@TK2MSFTNGP03.phx.gbl... >I have a form which takes information from a query. > The information is orizontally aranged in the many text boxes . > I would like to know how can i change the background colo...

Help with LOOKUP function
This function is in a workbook with 2 sheets. It _almost_ works perfectly. These "C" columns in two different sheets '2005-2006'!C:C,'2004-2005'!C:C, contain names of people. The D column in one of the sheets - '2004-2005'!D:D - contains a date associated with the person's name from the C column of 2004-2005 sheet. This formula is in the "D" column of Sheet 2005-2006. =LOOKUP('2005-2006'!C:C,'2004-2005'!C:C,'2004-2005'!D:D) The concept is for the formula to lookup the value (person's name) in column C of 2005-2006 a...

A Lookup function does not work
Hi, This is my first posting. I am using Exel 2000. I have 2 separate spreadsheets that have some similar columns but not all of the data in the similar columns is the same. What I want to do is take column A in spreadsheet#1 and find this same value in Column B in Spreadsheet#2 and then insert into column 3 in spreadsheet #1 a value from a different column in spreasheet #2 that corresponds to the row in which the value was looked up in Column B in spreadsheet#2. What I am doing is comparing 2 different inventory files that have stock codes in columns and quantities in another column, but n...

Use value from InputBox in Advanced ODBC Source
I'd like to include the posting date from a InputBox prompt in an advanced ODBC source. The post date would be used like select * from <complex join here> where postdate >= '<Date from Input>' and postdate < '<Date from input + 1>' The InputBox works well, I assign things to global variables, and such... Has anyone done this? If so, would you mind sharing your experience? I seem to have hit a brick wall If this cannot be done, I assume the task at hand is to create views from each query, and create simple ODBC sources, and go that way? Thanks...

CSV import into table not working...?
I'm trying to use this command to import a CSV file into a table... DoCmd.TransferText acImportDelim, "RetSpec", "tblRet", "\\drake\subcon \ret\data\ret.csv", False it never does it...any ideas? If I do a straight import using those Specifications "RetSpec" tblRet is poppulated with the data from the CSV file without any problems. Right above the DoCMD i have: On Error GoTo BadImport and BadImport is: BadImport: MsgBox "Ret data was NOT imported!!", vbOKOnly, "File Import Problems" Exit Sub Any ideas? I always get my...

Blank Repeated Values
I have a list in Column A that displays multiple data in an unfilled manner. I have a list in Column B that displays multiple data in a filled manner. How do I autofill the data points in Column A? Example: A1=1 A2:A9=(blank) A10=2 A11:A19=(blank) B1:B9=Blue B10:B19=Red I do not want to manually autofill each data break because there are 30,000+ rows of data (A1:A30000) with data points starting at 1(A1) to 15,000(A29999). The format looks like a finished pivot table. It looks like I am trying to copy a finished pivot table and pasting value to another sheet, then running a pivo...

Table properties
Is there a way to determine what the cell height is in Pub 2002? I know I can change it by dragging but I'm rather anal - I want to make all of them the same. -- The problem with resting on your laurels is that eventually you are sitting on dead branches. JoAnn What you do is select the whole table and say enter font size 16. Now when you go to make the Table smaller, the cells will only go to that point size. Consequently they will now all be the same height. You can now select the whole table again and change it to the point size of the font you want to use. Don't forget ...

Message text formatting
Hello, I am using Outlook 2007 as part of Office 2007 on XPSP2. When I send a message the formatting is fine. However, when I receive a reply, my original message has extra "line breaks" or carriage returns in it. Is there any way to prevent this? I already have Outlook set to remove extra line breaks. -- Thanks, Bob "BBran" <bbran@nowhere.com> wrote in message news:e21bDK%23uKHA.3368@TK2MSFTNGP06.phx.gbl... > I am using Outlook 2007 as part of Office 2007 on XPSP2. When I send a > message the formatting is > fine. However, when ...

linking tables from different Access templates?
Hello I have been playing with Access 2007 and am at the stage of almost being ready to ditch the "toy" database and prepare the real thing. I have been working on a database set up for us which has worked well but is showing its limitations (and highlighting mine!) I like the look of the Access 2007 Contacts and Events templates which, with some tweaking, could work well for us. My question is - is it possible to link the Contacts table with the Events table created in the templates? At the moment, I have an Events table (which includes various information abo...

return cell reference in a table based upon given lookup criteria
Is there a way to return the cell reference, or column/row coordinates, of a cell within an array or table by providing lookup criteria? Perhaps something like this: For a table of value in A1:E10 F1: (the value to find) G1: =ADDRESS(MAX((A1:E10=F1)*ROW(A1:E10)),MAX((A1:E10=F1)*COLUMN(A1:E10))) Note: Commit that array formula by holding down the [Ctrl][Shift] keys and press [Enter]. That formula returns the address of the 1st cell containing the value in F1, or #VALUE! if there is no match. Am I on the right track here? *********** Regards, Ron XL2002, WinXP-Pro "Travis" ...

Pivot Table Calculations #3
I am trying to run a pivot table report from an access database and I cannot get the pivot table to sum. It will show a count, but not a sum. When I choose the sum function, I get zero. I have used pt but this is the first time that I have had a problem and I am wondering if it has something to do with the way the database was set up in access. PB Most likely the numbers are brought in as Text. Ont the sheet in which they reside, format an empty cell as General. Copy that cell and select the data. Paste Special>Add>OK>Esc. Data should now be real numbers. Gord Dibben Excel...

Pivot table and OLAP excel 2000
Hi! When I create a pivot table report from OLAP source and then filter some data I get totals including the hidden fields. How could I display the totals of only filterd fields and not all? I notices that this works in Excel 2003, but one of our clients is using excel 2000 and the only thing I got is to export it to web component and then there turn of the totals of all field. Tnx in advance ...

Maintaining table formatting when pasting into web client email body?
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Hi, can anyone tell me how to paste a portion of an excel table into the body of a Microsoft Outlook Web Access email such that the table maintains all of its formatting (alignment)? I can't seem to figure it out. <br> Thx. <br> Bri ...

Displaying 120 Mega Pixels in 256 MB Video RAM
The first assumption is that 120 Mega Pixel image takes 480 MB, 32 bits per pixel, one byte each for red, green, and blue, and one byte of padding to 32-bits. I am estimating that displaying a 120 Mega Pixel image using a 256 MB video card should not be an issue because the actual display window would only use video memory for that portion of the image that is currently displayed. Thus a square image that is 11,000 pixels on each side should easily fit within video memory because most of this image would be scrolled off the screen. Can anyone please confirm (or deny) this analysis, and possi...