Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

make table query messes up data type 1

Status
Not open for further replies.

pduncan

IS-IT--Management
Jun 20, 2003
203
US
I have several tables that are created by make table queries. Later, these tables are queried again, and the results are use to populate a report. The problem is that one field in particular is "Question number." When I sort this field for the report, it is all messed up.
i.e.
...
48
49
5
50
51
... etc
I looked at the table that was made by the make table query, and the field data type is a text value.

How can I force the query to make the question number to be a number data type?

below is the SQL from a typical query:
SELECT dbo_tblAssessment.AssessmentName, dbo_tblAssessment.AssessmentStatus, dbo_tblAssessmentControl.ControlNumber, dbo_tblAssessmentControl.ControlDataType, dbo_tblAssessmentControl.BooleanValue INTO tbl_AMS_YesNo
FROM (dbo_tblAssessment INNER JOIN dbo_tblAssessmentControlGroup ON dbo_tblAssessment.AssessmentID = dbo_tblAssessmentControlGroup.AssessmentID) INNER JOIN dbo_tblAssessmentControl ON (dbo_tblAssessmentControlGroup.ControlGroupID = dbo_tblAssessmentControl.ControlGroupID) AND (dbo_tblAssessmentControlGroup.AssessmentID = dbo_tblAssessmentControl.AssessmentID)
WHERE (((dbo_tblAssessment.AssessmentName) Like "ams*") AND ((dbo_tblAssessment.AssessmentStatus)="closed" Or (dbo_tblAssessment.AssessmentStatus)="review") AND ((dbo_tblAssessmentControl.ControlDataType) Like "Yes*"))
ORDER BY dbo_tblAssessment.AssessmentName, dbo_tblAssessmentControl.ControlNumber;



PDUNCAN - MEMPHIS, TN

When I die, I want to die like my grandfather-- who died peacefully in
his sleep. Not screaming like all the passengers in his car.
 
Hi

Not sure which column equates to Question No but assuming it is ControlNumber, then forcing it to be an integer might help, note this will change teh column naem in the 'made' table of course

SELECT dbo_tblAssessment.AssessmentName, dbo_tblAssessment.AssessmentStatus, CInt(dbo_tblAssessmentControl.ControlNumber) As QuestionNo, dbo_tblAssessmentControl.ControlDataType, dbo_tblAssessmentControl.BooleanValue INTO tbl_AMS_YesNo
FROM (dbo_tblAssessment INNER JOIN dbo_tblAssessmentControlGroup

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Ken - that worked nicely. Thanks


PDUNCAN - MEMPHIS, TN

When I die, I want to die like my grandfather-- who died peacefully in
his sleep. Not screaming like all the passengers in his car.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top