Thanks dhookom,
I have fixed the sql to FROM [qryIS-1a]. [qryIS-1a] is the data that my subform [subfrmIS-1a] is based on.
Using the Expression Builder I added a control on my main form for the subform with its Control Source as
=[subfrmIS-1a].[Form]![qryIS-1]![Link1] but I only get #Name...
I've updated my code with dhookom's suggestion to just build an SQL statement for the recordset. I caught some referencing errors and fixed them. But, now I get the error 'External name not defined' when the execution gets to line with first reference of [subfrmIS-1a].
To clarify my querys...
I currently have code working to create a report on an entire database capturing all the changes in the current (live) database from a historical (aged) table of the same database. The problem I’m having is that as the day goes on, the report becomes less useful, as it too is “aged”.
I...
Hey dhookom,
Eureka!!!
It's working, red for first time new data, and red for changed data!
Thanks so much for you help!
Rather than using one CF command based on multiple conditions, making two CF condition commands works perfectly. I did some quick testing as it is a subform, and it works on...
Hey dhookom,
Sorry, To clarify:
Live = qryIS-1
Aged = tblqryIS-1
I'm looking for Null in tblqryIS-1 (aged) data.
Basically, as new engineering data is entered it gets red.
First time 'new' data is looking at 'Null' and should be red.
Subsequent 'new' data is looking at 'Not Equal' and also...
I tried ”IsNull([" & strTB2 & "])" but I get error ‘Expected: end of statement’. What I am learning is that expressions are not intuitive and do not return what I might expect.
The following works for getting red:
ctrl.FormatConditions.Add acFieldValue, acNotEqual, "[" & strTB2 & "]"
The...
Hey dhookom,
Your are correct, IsNull(Me(strTB2)) does return True or False. I understood that is what makes the text red or not.
When hard coding, the two rules that worked are:
Value <> [tblqryIS-1c.Signal]
Expression Is IsNull([tblqryIS-1c.Signal])
So far, these vba CF rules are working...
Yes, email your demo file and I’ll take a look at it.
I seem to be sooo close. I’ve been busy using F8 and stepping through most of today. I can tell what part of the If statements are running. I can see the values for the ctrl.FormatConditions(0).Modify and ctrl.FormatConditions.Add...
Thanks for your code examples on how to reference values/controls based on names stored in strings! I have that working now.
I just tried your code exactly on a test database and form, but it is not turning red. I checked the underlying data to be sure. Also, the Me(strTB2) is not bringing...
I have been using the debug.print line, I just moved it down where the code is working. I can get strTB1 and strTB2 printed correctly. I have tried to get their values to print using the following syntax:
Me.Recordset("fieldname") from this guidance:
Me.Recordset("fieldname") should work. And...
Hey dhookom, I'm getting much closer. I use ControlSource rather than Name because Name includes the Labels, and I'm just looking at the data controls. With that, I had to update my prefixes. In debug I can see all 5 'strFieldName' variables as well as strTB1 and strTB2. Both the .Modify and...
Hey dhookom, I've tested several times and still don't get the changed text to turn red. I debug the code below but can't seem to get a breakpoint to work inside the 'If' statement. I addded variable strFieldName and confirmed that the code correctly proceeds thru all controls (live & old)...
Thanks dhookom, yes I will do some testing. I need to study a bit more, but I see how it should work now.
Thanks again for all your help.
Bubba002
Technical User
The controls on the subform are only for the live data (qryIS-1). The aged data is not shown, but is only l-i-n-ked to be able to be available in the recordset. To keep the code tight and efficient, could I change the code to only CF the live data controls? (The aged data is archived and will...
Thanks dhookom, It looks like you changed the values with the 'tblqryIS-1c' prefix, which I use as the aged (archived) data, which would not change. Only the live data can change. I suppose that I can just change the prefix definitions to get it the way I want.
This got me to thinking, will...
Sorry, in dealing with the Preview issues I forgot to change the data in my database before I copied over to format it to post.
The aged data has the record as:
Field MOV 480VAC
As the project proceeds, I need to change that MOV signal to 120VAC. I use the comparison form to make the change to...
Sorry about that. Here are the tables converted to text with a tab separator for the columns. Just copying tables just concatenated the text in every row when I did the ‘Preview’.
Live data
qryIS-1.Loc qryIS-1.Type qryIS-1.Signal
Field 2Pos SW 120VAC
Field PB 120VAC
Field PB 120VAC...
Here are example lists of live and aged data with column header identifying the control name. FYI this is engineering data on instrumentation. The fields are for Location, Type, and Signal for the instrument. (MOV stands for Motor Operated Valve)
Live data
Aged data
For example, if the...
Hey dhookom, While looking close at your code,
The formula for defining variable strTB1 seems to remove the ‘prefix’ and returns only the ‘field’ name, which is what I am looking for in the CF expression box. However, I’m unclear on how the two If statements will work. In the Modify statement...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.