Simple qry using unbound textbox.

VegaLA

Registered User.
Local time
Today, 08:10
Joined
Jul 12, 2006
Messages
101
Hi all,
I am experiencing problems trying to put together what I thought was a simple form that would
allow users to search for data from a field on one table and display the results in a data grid style from the query I have created. However the query is'nt working and I am sure it is because of the way I have coded the query to read from the form's textbox. The SQL code is below.

SELECT tblFiles.Vault, tblFiles.Wlt, tblFiles.CD, tblFiles.Media, tblFiles.ProjectNo, tblFiles.ProjName, tblFiles.FileName, tblFiles.Location, tblFiles.NetLoc, tblFiles.CreDate
FROM tblFiles
WHERE (((tblFiles.FileName)=[forms]![frmArchive].[txtprjname].[value]));


There is a value in that field as 'attachment' and if I type that in the textbox it will find the records that have exactly that string but if I type 'att' there are no results. I tried searching in help for 'Like' since I believe that is the problem with my code but it did not show me an example of how to code that in the query to refer to the object on the form.

the code I have on the button next to the unbound textbox is as follows...

DoCmd.OpenQuery "qryFindPrjFile", acViewNormal, acReadOnly

Can anyone offer me any advice on how to do this?

Regards,
Mitch...
 
here's an example that uses a country-table:
Code:
SELECT tblCountry.*
FROM tblCountry
WHERE (((tblCountry.Country) Like "*" & [Forms]![frmAdminCountry]![txtCountry] & "*"));
you were getting close. don't forget that if you do figure out how to make a query work with the usual drag and drop interface, then you can switch to SQL view to see the coding (and copy that).
 

Users who are viewing this thread

Back
Top Bottom