Forcing a datatype in MS Access make table query

calendar_today Asked Dec 8, 2009
thumb_up 8 upvotes
history Updated April 16, 2026

Question posted 2009 · +5 upvotes

I have a query in MS Access which creates a table from two subqueries. For two of the columns being created, I’m dividing one column from the first subquery into a column from the second subquery.

The datatype of the first column is a double; the datatype of the second column is decimal, with scale of 2, but I want the second column to be a double as well.

Is there a way to force the datatype when creating a table through a standard make-table Access query?

Accepted answer +8 upvotes

One way to do it is to explicitly create the table before putting anything into it.

Your current statement is probably like this:

SELECT Persons.LastName,Orders.OrderNo
INTO Persons_Order_Backup
FROM Persons
INNER JOIN Orders
ON Persons.P_Id=Orders.P_Id
WHERE FirstName = 'Alistair'

But you can also do this:

----Create NewTable
CREATE TABLE NewTable(FirstName VARCHAR(100), LastName VARCHAR(100), Total DOUBLE)
----INSERT INTO NewTableusing SELECT
INSERT INTO NewTable(FirstName, LastName, Total)
SELECT FirstName, LastName, 
FROM Person p
INNER JOIN Orders o
ON p.P_Id = o.P_Id
WHERE p.FirstName = 'Alistair'

This way you have total control over the column types. You can always drop the table later if you need to recreate it.

2 code variants in this answer

  • Variant 1 — 6 lines, starts with SELECT Persons.LastName,Orders.OrderNo
  • Variant 2 — 9 lines, starts with ----Create NewTable

Top ms-access Q&A (6)

+8 upvotes ranks this answer #29 out of 55 ms-access solutions on this site .