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 Mike Lewis 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

    WHERE clause in the Set command of an db.OpenRecordset method

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

    WHERE clause in the Set command of an db.OpenRecordset method

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

    WHERE clause in the Set command of an db.OpenRecordset method

    Thanks dhookom and hermanlaksko for your suggestions! I'll have time later today to work on them. I'll let you know what happens.
  4. Bubba002

    WHERE clause in the Set command of an db.OpenRecordset method

    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...
  5. 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...
  6. 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...
  7. 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...
  8. 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...
  9. 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...
  10. 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...
  11. 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...
  12. 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...
  13. 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)...
  14. 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
  15. 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...
  16. 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...
  17. 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...
  18. 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...
  19. 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...
  20. 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...

Part and Inventory Search

Back
Top