Access 2010 - Make Table Query Losing LookUp data

daveatthewell

New Member
Joined
Jul 28, 2006
Messages
43
I have an Access "Membership-type" database with two tables as follows:
- [Countries] with the "CountryID" field set to autonumber and Primary Key and "ContactCountry" set to text
- [Members] with the usual data for a membership database including a "Country" field set to Number (using the Lookup wizard) and the following automatically set for the Lookup Tab Combo box, table/query, SELECT [Countries].[CountryID], [Countries].[ContactCountry] FROM [Countries] ORDER BY [ContactCountry]; . Another Field in this table is a Date Field "Renewal Date" which tells me the data when the member has renewed to.
I've created a Make Table query that uses the [Members] table (in which the Country field is a Combo Box display the NAME (not Record ID) of the Country) which returns all the fields of the [Members] table but only those records where the "Renewal Date" field contains a date greater than "a month ago" ie giving the member one months' grace and pastes them into a new table [Currently Active Members]

The SQL for the query is:

SELECT [Members].*, IIf([Renewal date]<=DateAdd("m",-1,Date()),False,True) AS Active INTO [Currently Active Members]
FROM [Members]
WHERE (((IIf([Renewal date]<=DateAdd("m",-1,Date()),False,True))=True));

The query runs OK and returns the correct data. However in the newly created table [Currently Active Members], the "Country" field now contains a number (which is of course the Record ID from the [Country] table and NOT the Text of the Country or as I would prefer it, the actual Combo Box with the name of the Country showing. Am I asking too much of Access to show the data as it was originally supplied to the query?
Any thoughts?

Dave Kennedy
Scotlandwell
 

Some videos you may like

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

xenou

MrExcel MVP, Moderator
Joined
Mar 2, 2007
Messages
16,669
Office Version
2013
Platform
Windows
Make table queries will not have lookups in them. If you want that you could create the table beforehand and populate it with an insert query rather than using a make table query (naturally you will first need to delete records from the table so you will have a "fresh" set of records each time you want to populate the table - end result will then be the same as what you have with your make table query).
 

daveatthewell

New Member
Joined
Jul 28, 2006
Messages
43
Thanks xenou. I guess I just don't understand the inner workings of how Access makes a table from a MakeTable query. If I create a new table (as in Create|Table) then go to my membership table and copy a Record, when I paste it into the new table, the Look up is carried with it. Wishful thinking, but I would have thought that on running the MakeTable query, every time a record is checked and meets the Criteria, the record is selected then "pasted" into the new table - but obviously not.

The good news is, however, (having had a play with it), in Design view of the table made as a result of the query, change the Data Type of the Country field from Number to LookUp, then on running the wizard, select the Countries Table and everything is then how it should be, complete with Combo Box etc. Pity Access isn't that smart!!

Thanks again.
Dave
 
Last edited:

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
53,626
Office Version
365
Platform
Windows
It looks like the table you are making has all of the fields of the Members tables, plus one more (the Active field).
So what I would probably do is copy the structure of your Members table (right-click on the Table, select Copy, right-click and select Paste and choose the "Structure Only" option).
Then manually add the Active field to this new blank table copy.
Then you can do an Append Query from the original table into this new table, much like xenou described.
 

welshgasman

Well-known Member
Joined
May 25, 2013
Messages
820
Lookups in Access tables confuse a lot of people. I believe most developers do not use them, as they just disguise the fact that all that is really held is a key.?
When you create a query and then ask for County="Wales", it will not work.

One of my first DBs used lookups, but now I do not use them. Instead I link them in the conventional way. That way I see the 'true' data, if I ever have to go direct to a table.
 

Watch MrExcel Video

Forum statistics

Threads
1,101,891
Messages
5,483,528
Members
407,397
Latest member
HerbA

This Week's Hot Topics

  • Finding issue in If elseif else with For each Loop
    Finding issue in If elseif else with For each Loop I have tried this below code but i'm getting in Y column filled with W005. Colud you please...
  • MsgBox Error
    Hi Guys, I have the below error show up when i try and run my macro in File1 but works fine if i copy and paste the same code into file2. [ATTACH...
  • CELL FORMAT - IF CONDITION
    My Cell Format is [B]""0.00" Cr". [/B]But in the cell, it is showing 123.00 for editing. (123 is entry figure). (Data imported from other...
  • Show numbers nearly the same
    Is this possible. I have a number that can change very time eg 0.00001234 Then I have a lot of numbers 0.0000001, 0.0000002, 0.00000004...
  • Please i need your help to create formula
    I need a formula in cell B8 to do this >>if b1=1 then multiply ( cell b8) by 10% ,if b1=2 multiply by 20%,if=3 multiply by 30%. Thank you in...
  • Got error while adding column and filter
    Got error while adding column and filter In column Z has some like "Success" and "Error". I want to add column in AA if the Z cell value is...
Top