Hi all. I'm hoping someone is able to help me with a problem I'm stuck with. :banghead:
I'm trying to create a query that supplies a form with data. I want to pass a TempVar to the query that is selected a from previously opened form.
The TempVar is setting correctly and I can see if this if I place a textbox (NewCID) on the form showing the TempVar. The problem I have is displaying on the records according to that TempVar. If I set the query manually, i.e. "|Test|" then records are displayed but if I use the TempVar, which also displays |Test| then no records are brought back.
I'm not sure what I'm doing wrong but I think it's something do with the vertical bar and that fact the field I'm searching on is a memo field, both of which I've no control over. I also have to use the Like statement because of this.
Here's the query that works...
SELECT *
FROM dbo_ASSETS
WHERE ASSET_CID Like "|Test|"
and the one that I want to use, that doesn't...
SELECT *
FROM dbo_ASSETS
WHERE ASSET_CID Like [TempVars]![tmpvarCID]
I've even tried referring to the textbox instead of the TempVar, i.e.
SELECT *
FROM dbo_ASSETS
WHERE ASSET_CID Like [Forms]![AssetsCID]![NewCID]
but that doesn't work either.
Any help would be gratefully received.
Thank you
Richard
I'm trying to create a query that supplies a form with data. I want to pass a TempVar to the query that is selected a from previously opened form.
The TempVar is setting correctly and I can see if this if I place a textbox (NewCID) on the form showing the TempVar. The problem I have is displaying on the records according to that TempVar. If I set the query manually, i.e. "|Test|" then records are displayed but if I use the TempVar, which also displays |Test| then no records are brought back.
I'm not sure what I'm doing wrong but I think it's something do with the vertical bar and that fact the field I'm searching on is a memo field, both of which I've no control over. I also have to use the Like statement because of this.
Here's the query that works...
SELECT *
FROM dbo_ASSETS
WHERE ASSET_CID Like "|Test|"
and the one that I want to use, that doesn't...
SELECT *
FROM dbo_ASSETS
WHERE ASSET_CID Like [TempVars]![tmpvarCID]
I've even tried referring to the textbox instead of the TempVar, i.e.
SELECT *
FROM dbo_ASSETS
WHERE ASSET_CID Like [Forms]![AssetsCID]![NewCID]
but that doesn't work either.
Any help would be gratefully received.
Thank you
Richard