hey... i have a form who's recordsource is a 3-field table. this form
prompts the user to enter a quarter and a year (which it then turns into a
date in an invisible control -- this control is bound to the date field in
the table, which is also the primary key) and then for 2 numbers, which it
then uses to open a quarterly report for my store. the form is
formfiquarterly, the controls are txtboxquarter, txtboxyear, txtboxdate (the
invisible one), txtboxnewFunits, txtboxusedFunits.
the way i have it set up, when you choose a quarter and a year, it will
calculate the date automatically. then, you enter the 2 unit fields before
clicking the button that opens the report. at that point, the form closes,
saving the units and the date to the table.
now, the problem is when i open the form, the date field DOES have the
recorded date in it but you can't see it. the two unit controls (bound) DO
show the corresponding units for that quarter that were used to generate the
report. what i need is for txtboxyear and txtboxquarter (which is a combo
box that i never changed the prefix for) to show the correct quarter and year
based on the date in txtboxdate. right now, it does not do this.
i don't know if you need to see this, but this is the code i have on the form:
Private Sub txtboxquarter_AfterUpdate()
Dim strdate As Date
If IsNull(Me.txtboxyear) = True Then
Exit Sub
Else
If Me.txtboxquarter = "1st Quarter" Then
strdate = DateSerial(Me.txtboxyear, 1, 1)
ElseIf Me.txtboxquarter = "2nd Quarter" Then
strdate = DateSerial(Me.txtboxyear, 4, 1)
ElseIf Me.txtboxquarter = "3rd Quarter" Then
strdate = DateSerial(Me.txtboxyear, 7, 1)
ElseIf Me.txtboxquarter = "4th Quarter" Then
strdate = DateSerial(Me.txtboxyear, 10, 1)
End If
End If
Me.txtboxdate = strdate
End Sub
Private Sub txtboxyear_AfterUpdate()
Dim strdate As Date
If IsNull(Me.txtboxquarter) = True Then
Exit Sub
Else
If Me.txtboxquarter = "1st Quarter" Then
strdate = DateSerial(Me.txtboxyear, 1, 1)
ElseIf Me.txtboxquarter = "2nd Quarter" Then
strdate = DateSerial(Me.txtboxyear, 4, 1)
ElseIf Me.txtboxquarter = "3rd Quarter" Then
strdate = DateSerial(Me.txtboxyear, 7, 1)
ElseIf Me.txtboxquarter = "4th Quarter" Then
strdate = DateSerial(Me.txtboxyear, 10, 1)
End If
End If
Me.txtboxdate = strdate
End Sub
if it helps to know this, what i had initially was an unbound form until i
realized that i needed to save the two numbers in the db somehow so that when
i want to look at an old quarterly report, i have all the parameters that i
used to generate it in the first place. i REALLY want to keep the design of
the combo box for the quarter and the text box for the year because of the
end-users of this form and their comfort level with computers. thanks for
your help here.
--
Greg
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200602/1