How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Richard Your Own Question

Richard
Richard, Software Specialist
Category: Microsoft Office
Satisfied Customers: 31329
Experience:  Over 15 year experience resolving Microsoft Office Issues
32989067
Type Your Microsoft Office Question Here...
Richard is online now
A new question is answered every 9 seconds

I am building a simple query with two tables. The data comes

Customer Question

I am building a simple query with two tables. The data comes out properly, but when I use criteria to filter for a specific data entry, it doesn't give the desired results. Additionally, when I filter for this particular data, it gives incorrect information.
I have a field named Program - There are 4 entries
20 Day HCG Program
40 Day HCG Program
30 Day Adipex Program
Resolution Program
In the criteria field under program I put 3* --- Like "3*" returned, and the data shows 40 Day HCG program.
In the criteria field under program I put 2* --- Like "2*" returned, and the data shows 20 Day HCG program.
In the criteria field under program I put 4* --- Like "4*" returned, and the data returns blank
Why is this happening and how do I fix it? In the table that stores the data, the field is of type short text.
Submitted: 1 year ago.
Category: Microsoft Office
Expert:  Richard replied 1 year ago.

HI there and welcome

Can I look at your file please? It will be easier.

Attach it by clicking the paperclip here and I can check it.

Customer: replied 1 year ago.
Says the file is to large to attach.
Expert:  Richard replied 1 year ago.

ok, go to http://ge.tt and attach it there and provide me the download link please

Customer: replied 1 year ago.
http://ge.tt/6G38voM2/v/0?cqryProgram_Specific
Customer: replied 1 year ago.
What's the status? I felt like this would be a simple explanation for an expert.
Expert:  Richard replied 1 year ago.

It was some time before you replied and I was not online, I will look at this now for you.

Customer: replied 1 year ago.
9 minutes Sir. It was only 9 minutes until I responded.
Expert:  Richard replied 1 year ago.

Ok, so the issue is the field you are querying is a lookup field its not actually storing the text which is why it does not work.

Expert:  Richard replied 1 year ago.

Convert the Program Field's Display Control under Lookup in the Tablet to Text Box, then re-enter the text correctly and you can then apply the like filter on the query and it works.

Customer: replied 1 year ago.
In the tblPrograms - the display control for program is set to text box. Is this where you are referring? It was already set to text box and still yields the same results as previously indicated. Please specify what you are telling me to change and where.
Expert:  Richard replied 1 year ago.

yes, but it is not already set to text box, I viewed this myself.

Convert the Program Field's Display Control under Lookup in the Tablet to Text Box, then re-enter the text correctly and you can then apply the like filter on the query and it works.

Customer: replied 1 year ago.
Sir, I am not understanding what you are telling me to do. Are you referring to tblPrograms? I open the table (tblPrograms), go to design view, click on Programs, Lookup, Display Control ----- it is already showing text box. I am not understanding what you are telling me to do. Can you please more specific?
Expert:  Richard replied 1 year ago.

ok, I gave the specific steps to get there, it is a lookup, this is why you have the problem and I saw this on your copy.,

I have changed it and uploaded it here

http://ge.tt/4mzwrrM2/v/0?c

You will now see the raw data for program in the query which will work on like statements now.

Let me know if you have difficulties.

Customer: replied 1 year ago.
OK Sir. Thank you for helping, however, that was not my intention or desired result. Please allow me to be a bit more specific. I have a table named tblPrograms that serves as a look up table for another table. The names of the programs thus far are the following: 30 Day Adipex Program, 20 Day HcG Program, 40 Day HcG Program, Resolution Program. Those are the only contents in the table. They are stored as short text and the display control is text box in the design view. I am creating a query called qryProgram_Specific, which is pulling data from two tables: tblTransactionRecord and tblPatients. In this query I need the following information filtered: from tblTransactionRecord - EntryDate, PatientID, Program, Addon(1), Addon(2), Addon (3); from tblPatients - LastName,FirstName. That is the intent of the query. When I filter the data for specific program information, that is where the problem arises. I am filtering the data from the query by Program. In the criteria, I put the following: 2*, Access will update to Like "2*" - and result is correct. It lists all 20 Day HcG Program entries. In the criteria, I put the following: 3*, Access will update to Like "3*" - and result is 40 Day HcG Program entries (This is incorrect). In the criteria, I put the following: 4*, Access will update to Like "4*" - and the result is blank.I am not certain if I can be more specific, but I didn't think you are understanding the issue. The issue is the result of the query filter on program. I need to the result of the filter to properly display the desired program name as it did with the criteria for Like "2*" and I am not understanding why it is not. I need to it display the program name, not an integer. It should return the data that is in the associated table, which is the program name.Does this better describe the issue, or I am missing what you are telling me? Additionally, I did not understand what you were telling me to change. If you would outline the steps, tables, etc, so I can understand and learn from what you may do to resolve the issue as it may come up in another query I run at a later date and I need to understand the root cause; how to fix; and ultimately how "Not" to create the problem.
Expert:  Richard replied 1 year ago.

the Root cause is you are using a lookup which you cannot do a like on as this is not the tables true data.

As I have been mentioning, it needs to be a text box which is what I did for you.

You created the problem by using a lookup field in a table which you should not do

I understand the issue, I am trying to tell you, and have shown you in my version, how to fix it.

so to reply to your statement "I need to the result of the filter to properly display the desired program name as it did with the criteria for Like "2*" and I am not understanding why it is not"

This is what I am explaining to you above.

Customer: replied 1 year ago.
It's showing me a digit - not program name. In tblTransactionRecord - It shows the program name - which comes from a lookup table. What should I do here? I thought it would be easier to have the data selected from a specified lookup value.In the version I have, why does it work for Like "2*"? It is the same data format.On the version you sent to me it returns 3 from Like "3*" - a digit.I am not understanding what you did. It appears to me that your version in placing the programID from tblPrograms into the program field inside of tblTransactionRecord. Then the query is returning the programID when Like"3*" is in the query filter because the programID is in the program field.
Expert:  Richard replied 1 year ago.

yes, as I mentioned you need to retype it in to get the full value.

Customer: replied 1 year ago.
Ok. I need to retype what and where?What about my tblProgram - which is used to populate tblTransactionRecord?Also, can you please outline exactly what you did and the steps - as I attempted to do earlier when I explained to you what I did to get this point and the results I am gettting? I want to use this as a learning experience and prevent this from being a problem in the future. With you doing the fix, - and I am not understanding what you did other than change the digits in the table- I can't learn nor replicate the solution. I do not want to have to retype the names in data fields - thus the reason i used a lookup table.Can you assist me in that regard, please Sir?
Expert:  Richard replied 1 year ago.

You need to type the values into the Program Field instead of just numbers.

Go to Table design, under Lookup for the program field (at the bottom)change it to Text Box, then re-enter the text correctly and you can then apply the like filter on the query and it works.

To redo the database you would have to make a new question

Customer: replied 1 year ago.
Sir - what table are you referring? tblTransactionRecord and tblProgram both have text box in the lookup field. I am not understanding why there can not be a look up table to get the information.When there is a limited amount of responses for a particular field - why wouldn't/couldn't using a look up table be used to select the appropriate data input?The question asked is - " What program is the patient going to do?" Limited answers - 20 Day HcG, 30 Day Adipex, 40 Day HcG, or Resolution. Why would that have to be typed for every entry? I am not understanding why that is wrong and incorrect.
Expert:  Richard replied 1 year ago.

I am opting out on working with you on this as I have tried many times to explain why. I have even supplied you with the database with it solved, so I am out of ideas on how to explain it in another manner.

You do not need to do anything, you will be notified when someone takes over your case.

Thank you