Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. Bubba002

    Pass a subform fieldname-ID as a string variable in CF expression

    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...
  2. Bubba002

    Pass a subform fieldname-ID as a string variable in CF expression

    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...
  3. Bubba002

    Pass a subform fieldname-ID as a string variable in CF expression

    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...
  4. Bubba002

    Pass a subform fieldname-ID as a string variable in CF expression

    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...
  5. Bubba002

    Pass a subform fieldname-ID as a string variable in CF expression

    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...
  6. Bubba002

    Pass a subform fieldname-ID as a string variable in CF expression

    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...
  7. Bubba002

    Pass a subform fieldname-ID as a string variable in CF expression

    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...
  8. Bubba002

    Pass a subform fieldname-ID as a string variable in CF expression

    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...
  9. Bubba002

    Pass a subform fieldname-ID as a string variable in CF expression

    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)...
  10. Bubba002

    Pass a subform fieldname-ID as a string variable in CF expression

    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
  11. Bubba002

    Pass a subform fieldname-ID as a string variable in CF expression

    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...
  12. Bubba002

    Pass a subform fieldname-ID as a string variable in CF expression

    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...
  13. Bubba002

    Pass a subform fieldname-ID as a string variable in CF expression

    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...
  14. Bubba002

    Pass a subform fieldname-ID as a string variable in CF expression

    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...
  15. Bubba002

    Pass a subform fieldname-ID as a string variable in CF expression

    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...
  16. Bubba002

    Pass a subform fieldname-ID as a string variable in CF expression

    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...
  17. Bubba002

    Pass a subform fieldname-ID as a string variable in CF expression

    Thanks dhookom, I'm going to take a close look at your approach. Bubba002 Technical User
  18. Bubba002

    Pass a subform fieldname-ID as a string variable in CF expression

    Hey dhookom,below is what I want my CF Rules Manager box to look like: Instead of hard-coding “[tblqryIS-1c.Signal]” with the ‘prefix’&’field’ (in this example the prefix is ‘tblqryIS-1c.’ and the field is ‘Signal’), I would use my variable (SVI). I would define the prefix as...
  19. Bubba002

    Pass a subform fieldname-ID as a string variable in CF expression

    Thanks Andrzejek, that function looks just like what I want to do. But how do I make strCtrlName dynamically refer to the self-reference control name? My subform contains many fields where ‘live’ data is compared to ‘aged’ data (datasheet view). So when the subform opens, all those fields...
  20. Bubba002

    Pass a subform fieldname-ID as a string variable in CF expression

    Thanks dhookom, I just printed out a reference for Form and Subform properties and controls, I see the correct way to refer to a control on subform-1 from subform-1 is Me!ControlName. I'll be using that from now on. Bubba002 Technical User

Part and Inventory Search

Back
Top