G
Guest
Hi, more problems (late, I want to go home). Please help.
I am using the following code to try to create a report, and am having three
problems with the following code (long, sorry):
Dim stDocName As String
Dim plan_date As Date
Dim project As String
Dim end_date As Date
Dim time_left As Integer
Dim first_del As Date
Dim user_test_end As Date
Dim user_test_beg As Date
Dim end_devel As Date
Dim beg_devel As Date
Dim X As Integer
Dim Y As Integer
plan_date = Now()
project = txtPROJECTID
end_date = dtmDUEDATE
time_left = dblETC
first_del = end_date + 2
user_test_end = end_date - 4
user_test_beg = end_date - 7
end_devel = end_date - 8
X = 1
Y = time_left
Do While Y > 0
' If Weekday(end_devel - X, 2) > 5 Then
' work = 0
' Else
work = 2
Y = Y - work
X = X + 1
Loop
begin_dev = end_devel - X
stDocName = "rptPROJ_WORKLOAD"
DoCmd.OpenReport stDocName, acPreview
Reports(stDocName).Text2 = project
Reports(stDocName).Text4 = end_date
Reports(stDocName).Text6 = time_left
Reports(stDocName).Text8 = first_del
Reports(stDocName).Text10 = user_test_end
Reports(stDocName).Text12 = user_test_beg
Reports(stDocName).Text13 = end_devel
Reports(stDocName).Text14 = begin_dev
Exit_Command27_Click:
Exit Sub
Err_Command27_Click:
MsgBox Err.Description
Resume Exit_Command27_Click
End Sub
Question 1 - when I try to uncomment the lines in the Do...Loop to include
the if then else, I get an error message that I have a loop without a do
statement.
Question 2 - When I run this, I get a blank report, but when I go toggle
between design and preview mode, the data shows up where I would expect. I
think the assign variable statements are in the wrong place in relation to
the docmd.openreport.
Question 3 - most tricky. When I run this, then toggle back and forth
between design and preview mode, I get data, but only the first record of
from the query/form this is being produced from, what do I do to make the
report show every record from the source form (which is a continuous form -
is that a hint?).
Thanks for your help.
I am using the following code to try to create a report, and am having three
problems with the following code (long, sorry):
Dim stDocName As String
Dim plan_date As Date
Dim project As String
Dim end_date As Date
Dim time_left As Integer
Dim first_del As Date
Dim user_test_end As Date
Dim user_test_beg As Date
Dim end_devel As Date
Dim beg_devel As Date
Dim X As Integer
Dim Y As Integer
plan_date = Now()
project = txtPROJECTID
end_date = dtmDUEDATE
time_left = dblETC
first_del = end_date + 2
user_test_end = end_date - 4
user_test_beg = end_date - 7
end_devel = end_date - 8
X = 1
Y = time_left
Do While Y > 0
' If Weekday(end_devel - X, 2) > 5 Then
' work = 0
' Else
work = 2
Y = Y - work
X = X + 1
Loop
begin_dev = end_devel - X
stDocName = "rptPROJ_WORKLOAD"
DoCmd.OpenReport stDocName, acPreview
Reports(stDocName).Text2 = project
Reports(stDocName).Text4 = end_date
Reports(stDocName).Text6 = time_left
Reports(stDocName).Text8 = first_del
Reports(stDocName).Text10 = user_test_end
Reports(stDocName).Text12 = user_test_beg
Reports(stDocName).Text13 = end_devel
Reports(stDocName).Text14 = begin_dev
Exit_Command27_Click:
Exit Sub
Err_Command27_Click:
MsgBox Err.Description
Resume Exit_Command27_Click
End Sub
Question 1 - when I try to uncomment the lines in the Do...Loop to include
the if then else, I get an error message that I have a loop without a do
statement.
Question 2 - When I run this, I get a blank report, but when I go toggle
between design and preview mode, the data shows up where I would expect. I
think the assign variable statements are in the wrong place in relation to
the docmd.openreport.
Question 3 - most tricky. When I run this, then toggle back and forth
between design and preview mode, I get data, but only the first record of
from the query/form this is being produced from, what do I do to make the
report show every record from the source form (which is a continuous form -
is that a hint?).
Thanks for your help.