Hi,
I have a form with a calendar control - on selecting a date it opens two other forms. One form - "Pledges_Date" - uses a query as a control source, with a filter being passed from the mail form.
The second form - "Pledges_Date_New_Rep" - uses the selected date passed via OpenArgs to populate a text box.
If both of the two secondary forms are closed, selecting a date from the main form will open the two forms with the correct data. Upon selecting a new date again from the first form, the filtered form - "Pledges_Date" - will redisplay itself but the form with the text box - "Pledges_Date_New_Rep" - remains displaying the openargs passed date from when it was originally opened. If it is closed and a new date selected, it displays the correct date.
The code from the main form is:
#########################################
Private Sub ActiveXCtl0_DateClick(ByVal DateClicked As Date)
Dim datCalDate As Date 'variable to store selected date
Dim stDocName1 As String
Dim stDocName2 As String
Dim stLinkCriteria1 As String
datCalDate = ActiveXCtl0.Value
stDocName1 = "Pledges_Date"
stDocName2 = "Pledges_Date_New_Rep"
stLinkCriteria1 = "[PledgeDate]=" & "#" & datCalDate & "#"
DoCmd.OpenForm stDocName1, , , stLinkCriteria1
DoCmd.OpenForm stDocName2, , , , , , datCalDate
End Sub
############################################
So, upon dateclick, the form Pledges_date is redisplayed with the new filter, but the form Pledges_Date_New_Rep still displays the value of datCalDate of when it was first opened. (The text box's properties source is set to: "=[OpenArgs]"
Any thoughts welcome
I have a form with a calendar control - on selecting a date it opens two other forms. One form - "Pledges_Date" - uses a query as a control source, with a filter being passed from the mail form.
The second form - "Pledges_Date_New_Rep" - uses the selected date passed via OpenArgs to populate a text box.
If both of the two secondary forms are closed, selecting a date from the main form will open the two forms with the correct data. Upon selecting a new date again from the first form, the filtered form - "Pledges_Date" - will redisplay itself but the form with the text box - "Pledges_Date_New_Rep" - remains displaying the openargs passed date from when it was originally opened. If it is closed and a new date selected, it displays the correct date.
The code from the main form is:
#########################################
Private Sub ActiveXCtl0_DateClick(ByVal DateClicked As Date)
Dim datCalDate As Date 'variable to store selected date
Dim stDocName1 As String
Dim stDocName2 As String
Dim stLinkCriteria1 As String
datCalDate = ActiveXCtl0.Value
stDocName1 = "Pledges_Date"
stDocName2 = "Pledges_Date_New_Rep"
stLinkCriteria1 = "[PledgeDate]=" & "#" & datCalDate & "#"
DoCmd.OpenForm stDocName1, , , stLinkCriteria1
DoCmd.OpenForm stDocName2, , , , , , datCalDate
End Sub
############################################
So, upon dateclick, the form Pledges_date is redisplayed with the new filter, but the form Pledges_Date_New_Rep still displays the value of datCalDate of when it was first opened. (The text box's properties source is set to: "=[OpenArgs]"
Any thoughts welcome