By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,870 Members | 1,212 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,870 IT Pros & Developers. It's quick & easy.

Return to the same date in calendarcontrol

P: n/a
Hi!

I have the following headpuzzle:

On a form (frmAgenda) I have a calendar control and a listbox.
When user clicks date in calendar, the listbox will show some
information that will be displayed in several rows.

Then the user can doubleclick an item in the listbox and the chosen item
will be displayed in another form (frmDisplay). At the
same time the frmAgenda will close.

Now when the user chooses to close frmDisplay, frmAgenda will
again be opened. However...frmAgenda will always open and display
now (todays date).

How can I have frmAgenda open on the same date the user choose to
begin with ( say 12 days back from todays date)? Clearly he might
want to open more items from the listbox on the actual date he
choosed to start with!

Hope this wasn't to complicated...

Me.Name
Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Rather than closing frmAgenda when you double click on the listbox, just
make frmAgenda not visible. Have frmAgenda become visible again when
frmDisplay closes. FrmAgenda will this way be on the same date as originally
selected.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"Geir Baardsen" <ge***********@hotmail.com> wrote in message
news:35**************************@posting.google.c om...
Hi!

I have the following headpuzzle:

On a form (frmAgenda) I have a calendar control and a listbox.
When user clicks date in calendar, the listbox will show some
information that will be displayed in several rows.

Then the user can doubleclick an item in the listbox and the chosen item will be displayed in another form (frmDisplay). At the
same time the frmAgenda will close.

Now when the user chooses to close frmDisplay, frmAgenda will
again be opened. However...frmAgenda will always open and display
now (todays date).

How can I have frmAgenda open on the same date the user choose to
begin with ( say 12 days back from todays date)? Clearly he might
want to open more items from the listbox on the actual date he
choosed to start with!

Hope this wasn't to complicated...

Me.Name

Nov 13 '05 #2

P: n/a
"PC Datasheet" <no****@nospam.spam> wrote in message news:<Nz*****************@newsread2.news.atl.earth link.net>...
Rather than closing frmAgenda when you double click on the listbox, just
make frmAgenda not visible. Have frmAgenda become visible again when
frmDisplay closes. FrmAgenda will this way be on the same date as originally
selected.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

Sorry.
Access 2000 will not let me open two instances of tblOrders. The item
being doubleclicked in the listbox on frmAgenda is
OrderID,OrderNr,CompanyName from tblOrders and the frmDisplay is the
selected OrderNr from tblOrders, showing the actual order which is
being doubleclicked in frmAgenda.
Me.Name

Nov 13 '05 #3

P: n/a
ge***********@hotmail.com (Geir Baardsen) wrote in message news:<35**************************@posting.google. com>...
Hi!

I have the following headpuzzle:

On a form (frmAgenda) I have a calendar control and a listbox.
When user clicks date in calendar, the listbox will show some
information that will be displayed in several rows.

Then the user can doubleclick an item in the listbox and the chosen item
will be displayed in another form (frmDisplay). At the
same time the frmAgenda will close.

Now when the user chooses to close frmDisplay, frmAgenda will
again be opened. However...frmAgenda will always open and display
now (todays date).

How can I have frmAgenda open on the same date the user choose to
begin with ( say 12 days back from todays date)? Clearly he might
want to open more items from the listbox on the actual date he
choosed to start with!

Hope this wasn't to complicated...

Me.Name


In the double click code, send the date string to frmDisplay in the
open args. In the frmDisplay unload event where you open frmAgenda,
pass the date string back in its openargs. Have frmAgenda's Load
event check the openargs and set the control to that date if it
exists; otherwise set it to today's date.

James A. Fortune
Nov 13 '05 #4

P: n/a
ja******@oakland.edu (James Fortune) wrote in message news:<a6**************************@posting.google. com>...
ge***********@hotmail.com (Geir Baardsen) wrote in message news:<35**************************@posting.google. com>... In the double click code, send the date string to frmDisplay in the
open args. In the frmDisplay unload event where you open frmAgenda,
pass the date string back in its openargs. Have frmAgenda's Load
event check the openargs and set the control to that date if it
exists; otherwise set it to today's date.

James A. Fortune

Hi!

Thank you James Fortune. Before I saw your answer I worked out the
following "original" solution:

On frmAgenda the user can click a calendarcontrol, that will update
a listbox with orders produced on that date. Now the user can doubleclick
one of the items and have the order displayed in another form, and then
he can print it, if he chooses.

First I put a textbox on frmDisplay (txtMineDatum). To this textbox I sent
the value of the calendarcontrol on frmAgenda.

In the doubleclick event of the listbox, frmAgenda I wrote:

Private Sub lstGetThisOrder_DblClick(Cancel As Integer)
On Error GoTo Err_GetThisOrder_Click

Dim stDocName As String
Dim stLinkCriteria As String
Dim dtMyDate As Date

dtMyDate = Me!MineCal.Value

stDocName = "frmDisplay"
stLinkCriteria = "[Ordernr]=" & Me!lstGetThisOrder.Column(2)
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms!frmDisplay!txtMineDatum.Value = dtMyDate

If IsLoaded("frmAgenda") Then
DoCmd.Close acForm, "frmAgenda", acSaveYes
End If
End Sub

....and now the frmDisplay will open and show the
.................doubleclicked item in frmAgenda.

....So, in order to return to the same date in
.....calendar on frmAgenda I did the
......following code in the cmdclose button event
.......on frmDisplay:

Private Sub cmdMineClose_Click()

Dim dtMyDate As Date

dtMyDate = Me!txtMineDatum.Value

DoCmd.Close
If Not IsLoaded("frmAgenda") Then
DoCmd.OpenForm ("frmAgenda")

Forms!frmAgenda!MineCal.Value = dtMyDate

With Forms!frmAgenda!lstGetThisOrder
.RowSource = ""
.ColumnCount = 4
.ColumnHeads = True
.ColumnWidths = "0cm;0cm;2cm;5,5cm"
.BoundColumn = 1
.RowSource = "SELECT DISTINCTROW " etc.
End With
End If
End Sub

........and it works!

However, your solution seems to be nicer and I will probably switch
to this.

....Happy tribulations....

Me.Name
Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.