A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Conditional formatting with SQL Select from another table



 
 
Thread Tools Display Modes
  #1  
Old November 3rd, 2009, 03:04 PM posted to microsoft.public.access.forms
MagnusS
external usenet poster
 
Posts: 2
Default Conditional formatting with SQL Select from another table

Hi,

I trying to set the font color in a textbox using this "Expression is":
[txtProdAvailableDate]=Date() And [ProdAvailableChk]=-1 And
[txtProdAvailableDate](SELECT [tblLog].[ProdAvCheckedDate] FROM [tblLog]
WHERE [ID]=Forms![frmTracing].[txtID]).
This doesn't give any error message but neither does it change the font color.

I have this expression working:
[txtProdAvailableDate]=Date() And [ProdAvailableChk]= 0

Any suggestion on how to solve the string where I use the SELECT statement?

Cheers,
/Mag
  #2  
Old November 3rd, 2009, 03:15 PM posted to microsoft.public.access.forms
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default Conditional formatting with SQL Select from another table

You can't use SELECT statements like that. Try using DLookup:

[txtProdAvailableDate]DLookup("[ProdAvCheckedDate]", "[tblLog]", "[ID]=" &
Forms![frmTracing].[txtID])


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"MagnusS" wrote in message
...
Hi,

I trying to set the font color in a textbox using this "Expression is":
[txtProdAvailableDate]=Date() And [ProdAvailableChk]=-1 And
[txtProdAvailableDate](SELECT [tblLog].[ProdAvCheckedDate] FROM [tblLog]
WHERE [ID]=Forms![frmTracing].[txtID]).
This doesn't give any error message but neither does it change the font
color.

I have this expression working:
[txtProdAvailableDate]=Date() And [ProdAvailableChk]= 0

Any suggestion on how to solve the string where I use the SELECT
statement?

Cheers,
/Mag



  #3  
Old November 3rd, 2009, 07:54 PM posted to microsoft.public.access.forms
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default Conditional formatting with SQL Select from another table

MagnusS -

You might try putting a hidden field on your form, and setting the value to
be the results of your SQL statement. Then in your formatting expression,
use the value of this hidden field instead of the SQL statement.
--
Daryl S


"MagnusS" wrote:

Hi,

I trying to set the font color in a textbox using this "Expression is":
[txtProdAvailableDate]=Date() And [ProdAvailableChk]=-1 And
[txtProdAvailableDate](SELECT [tblLog].[ProdAvCheckedDate] FROM [tblLog]
WHERE [ID]=Forms![frmTracing].[txtID]).
This doesn't give any error message but neither does it change the font color.

I have this expression working:
[txtProdAvailableDate]=Date() And [ProdAvailableChk]= 0

Any suggestion on how to solve the string where I use the SELECT statement?

Cheers,
/Mag

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:30 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.