Hey all...
Please have a quick look at my form first...
By f22a at 2008-09-25
I've worked up some code as below...
Now as I'm new to VBA and Access forms, I'm sure my approach will be frowned upon by alot of you.
But you can see what I'm trying to do right?
Hopefully with your help I'll be able to convert the query in the message box into a "RunSQL" (I think) and have the loop stop when a cboSelectProject is empty.
If my code has started off on the wrong foot, I'm open to new ideas.
Thanks!
Please have a quick look at my form first...
By f22a at 2008-09-25
I've worked up some code as below...
Code:
Function vbaTestAppend()
Dim frm As Form
Dim project_count As Integer
Dim day_count As Integer
Set frm = Forms!frmEmployeeTimesheet
project_count = 0
day_count = 0
Do
project_count = project_count + 1
day_count = 0
Do
day_count = day_count + 1
MsgBox "INSERT INTO tblHours ( [Project ID], [Employee ID], Date, Hours ) SELECT Forms!frmEmployeeTimesheet!cboSelectProject" & project_count & ", Forms!frmEmployeeTimesheet!cboSelectName, Forms!frmEmployeeTimesheet!txtDay" & day_count & ", Forms!frmEmployeeTimesheet!txtProj1Day" & day_count & ";"
Loop Until day_count = 7
Loop Until project_count = 5
End Function
Now as I'm new to VBA and Access forms, I'm sure my approach will be frowned upon by alot of you.
But you can see what I'm trying to do right?
Hopefully with your help I'll be able to convert the query in the message box into a "RunSQL" (I think) and have the loop stop when a cboSelectProject is empty.
If my code has started off on the wrong foot, I'm open to new ideas.
Thanks!