Hello and thanks for the help!!
I am a pretty good VBA programmer for Excel but am a novice in Access. I am creating a database that employees can use to forecast how many hours they are going to be working on a project. In a form (frmSelectPerson) they use a combo box to select who they are and a date picker to choose the date. I then open a report (rptWrkEntry) and have that filtered to only their projects. Now, here is where I kind of get lost due to the dynamic nature of Access Reports. I have the Page Header as the date (start date is chosen on the previous form and I go 10 more weeks out) and that is working just fine. Then, I have the projects that person is working on as the rows, which could be 1 or 20. So now we are looking at a matrix, rows are Projects, columns are dates, and now I need to fill in the middle with hours, if they have been entered (if so, they have the option to update them and if not then leave it blank). Now, when you are looking at the report in Design View, there is only one row and the "middle" text boxes are called "txtHours1" to "txtHours10" but once the report is populated there could be three rows, so how to grab these text boxes in VBA IDK. Here is what I am looking for:
for I=0 to me.controls.count
set c=me.controls(I)
if instr(1, c.name, "Hours") then
'grab the associated project name so what row am I in
'grab the associated date, so what column I am in
'go to the Update table and see if that date/Project combo already has hours entered and, if so, populate txtHours
'if not leave txtHours empty
end if
next I
Right now I have this just with debug.print c.name to see but all it is giving me is the 10 I created. However, this is upon Report_Load, is there another event I should be using?
Holy macaroni, does that make sense at all?
Thanks for reading my rambling explanation!!
Me
I am a pretty good VBA programmer for Excel but am a novice in Access. I am creating a database that employees can use to forecast how many hours they are going to be working on a project. In a form (frmSelectPerson) they use a combo box to select who they are and a date picker to choose the date. I then open a report (rptWrkEntry) and have that filtered to only their projects. Now, here is where I kind of get lost due to the dynamic nature of Access Reports. I have the Page Header as the date (start date is chosen on the previous form and I go 10 more weeks out) and that is working just fine. Then, I have the projects that person is working on as the rows, which could be 1 or 20. So now we are looking at a matrix, rows are Projects, columns are dates, and now I need to fill in the middle with hours, if they have been entered (if so, they have the option to update them and if not then leave it blank). Now, when you are looking at the report in Design View, there is only one row and the "middle" text boxes are called "txtHours1" to "txtHours10" but once the report is populated there could be three rows, so how to grab these text boxes in VBA IDK. Here is what I am looking for:
for I=0 to me.controls.count
set c=me.controls(I)
if instr(1, c.name, "Hours") then
'grab the associated project name so what row am I in
'grab the associated date, so what column I am in
'go to the Update table and see if that date/Project combo already has hours entered and, if so, populate txtHours
'if not leave txtHours empty
end if
next I
Right now I have this just with debug.print c.name to see but all it is giving me is the 10 I created. However, this is upon Report_Load, is there another event I should be using?
Holy macaroni, does that make sense at all?
Thanks for reading my rambling explanation!!
Me