I have created a query with one row of data, and six columns in this layout:
Month/Year in Question, Location, Criteria1, Criteria2, Criteria3, Criteria4
This layout could change to two rows at some point in the future, though I could create a second query where the Location is unique so that I maintain a single row if that is more efficient. My problem is that I cannot decipher how the DAO code references data in a query. I cannot find a detailed comment set that describes what the various parts do. I want to be able within VBA to compare a result in a text box in the AfterUpdate option to one of the criteria in the query. For instance, my continuous form has a text box called "Incremental_Grade", after a user inputs a numeric value in this text box and hits enter, or tab, the AfterUpdate action is called and the VBA code should go to the query, and look at column 4 to see what the numeric value for Criteria2 is, if the result is below this value then do some action, if above this value, then do another action. The if statements seem fairly straight forward, but the syntax for referencing the query result has me lost. There are four text boxes on this continuous form, and each one will have an AfterUpdate trigger that will each individually check a different Criteria from the query.
I cannot understand what the various parts of the DAO code do, so I don't know how to tell it to reference that specific column and compare those numbers. Would I be better off to try using a Dlookup to compare these values?
To complicate this somewhat, the query in question could be blank if someone forgot, or didn't have data to enter criteria for that particular month and year. As a result I've got a second query in the same format that has a set of default values to use instead. So what I need to be able to do is check the primary query first, if blank, then go to the secondary query with the default values in it, and use the same criteria2 from it instead.
Month/Year in Question, Location, Criteria1, Criteria2, Criteria3, Criteria4
This layout could change to two rows at some point in the future, though I could create a second query where the Location is unique so that I maintain a single row if that is more efficient. My problem is that I cannot decipher how the DAO code references data in a query. I cannot find a detailed comment set that describes what the various parts do. I want to be able within VBA to compare a result in a text box in the AfterUpdate option to one of the criteria in the query. For instance, my continuous form has a text box called "Incremental_Grade", after a user inputs a numeric value in this text box and hits enter, or tab, the AfterUpdate action is called and the VBA code should go to the query, and look at column 4 to see what the numeric value for Criteria2 is, if the result is below this value then do some action, if above this value, then do another action. The if statements seem fairly straight forward, but the syntax for referencing the query result has me lost. There are four text boxes on this continuous form, and each one will have an AfterUpdate trigger that will each individually check a different Criteria from the query.
I cannot understand what the various parts of the DAO code do, so I don't know how to tell it to reference that specific column and compare those numbers. Would I be better off to try using a Dlookup to compare these values?
To complicate this somewhat, the query in question could be blank if someone forgot, or didn't have data to enter criteria for that particular month and year. As a result I've got a second query in the same format that has a set of default values to use instead. So what I need to be able to do is check the primary query first, if blank, then go to the secondary query with the default values in it, and use the same criteria2 from it instead.