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
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
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).
 
Upvote 0
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:
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,241
Members
452,622
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top