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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Don't understand Qry results...need some help

Status
Not open for further replies.

NRK

Technical User
Feb 13, 2002
116
US
I have a Qry that is the basis for a word report exported from Access. The concept works, but my difficulty lies in the integration between Access and Word.

One of my fields (ID) has a numberic data type (values 1-5), but throughout my database these values are set to other values (1=Pass, 2=Fail, etc.). I needed to do this as I often need to count records and the number of IDs.

But, when I push my data to table created in Word the values are numeric. So, is there any way that I can state that 1=Pass somewhere in my code or in my query?

Any help would be greatly appreciated!
 
Sure, there's a few ways you can do this...

1 - create a table (call it "codes") that lists code/text pairs, eg

1 Pass
2 Fail
etc

now just join to codes in your report query and include the code text rather than (or as well as) the value.

2 - If the code/text isn't likely to change you could just use the choose function, eg:

choose(mycode,"Pass","Fail", etc)

Best Regards,
Mike
 
Mike - Thanks for the ideas. This is my query:
SELECT qryWordReport.tcID AS ID, qryWordReport.tcDescription AS Description, " & _
"qryWordReport.tcStatus AS Status, qryWordReport.BuildID AS [Build Version] " & _
"FROM qryWordReport


Using your second idea (as I do not want to have another table if I can help it), where would I put that function?

 
SELECT choose(qryWordReport.tcID,"Pass","Fail", etc) AS ID, qryWordReport.tcDescription AS Description, " & _
"qryWordReport.tcStatus AS Status, qryWordReport.BuildID AS [Build Version] " & _
"FROM qryWordReport

Choose is a fairly limited function but its perfect in this example. Have a look at the help page. Best Regards,
Mike
 
Fantastic - did look at the help page and combined with your explanation, it has worked...

Thanks so much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top