If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Time to Allen Browne' calendar
Good Day All,
I have been attempting for days now various ways to include the time with the date to a field when using Allen Browne's popup calendar; similar to Now(). I have searched Google, Yahoo, Microsoft and the Discussion Groups. Surely, someone has done it or needed it. If you know how this can be accomplished, if you could graciously provide the instruction and coding, it will very much appreciated. Thanks |
#2
|
|||
|
|||
Time to Allen Browne' calendar
Hello Beeyen
I have been trying to answer this question for you in another newsgroup - microsoft.public.access. Allen's calendar form returns only a date, with no time component. If you want the result to include a time as well, then you will need to input the time separately and add it to the date selected in the calendar. I don't know of any popup calendar that will return both a date AND a time. You can input the time in a number of different ways. The simplest would be to have a textbox where the user types the time - for example, "9:30" or "18:15" or "4:40 pm". Another option would be to have a combo box listing selectable times in increments of, say 15 minutes, for the period of the day that is most likely required. So long as the combo box does not have the LimitToList property set, the user could type another time in, if the required one were not in the list. Another option would be to have two combo boxes to select hours and minutes, and maybe an option group to select am or pm. This form of time selection is used on many web pages, but personally, I find it extremely annoying and time-consuming to use. Once the time has been inputted or selected, you can add it to the selected date and store it. If you really want to have the date AND time returned by the popup calendar, then add your time selection control(s) to Allen's form, and change the code behind the OK button to add the time to the selected date before returning the result. -- Good Luck :-) Graham Mandeno [Access MVP] Auckland, New Zealand "Beeyen" wrote in message ... Good Day All, I have been attempting for days now various ways to include the time with the date to a field when using Allen Browne's popup calendar; similar to Now(). I have searched Google, Yahoo, Microsoft and the Discussion Groups. Surely, someone has done it or needed it. If you know how this can be accomplished, if you could graciously provide the instruction and coding, it will very much appreciated. Thanks |
#3
|
|||
|
|||
Time to Allen Browne' calendar
Good Day Graham Mandeno
Thank you for your patience, I have been working on this the past four days and I think perhaps I am getting closer. I chose the last option and have entered the Me.TxtDate = Now(). But what occurs when I select “OK” is the time flickers then the date is enters as usual. Would you have a suggestion as to where in the statement below I might place the correct coding for the time/date result? Let me know Thanks Private Sub cmdOk_Click() On Error Resume Next 'Purpose: Transfer the result back to the calling text box (if there is one), and close. If Me.cmdOk.Enabled Then If gtxtCalTarget = Me.txtDate Then Me.txtDate = Now() 'do nothing Else gtxtCalTarget = Me.txtDate End If End If gtxtCalTarget.SetFocus DoCmd.Close acForm, Me.Name, acSaveNo End Sub "Graham Mandeno" wrote: Hello Beeyen I have been trying to answer this question for you in another newsgroup - microsoft.public.access. Allen's calendar form returns only a date, with no time component. If you want the result to include a time as well, then you will need to input the time separately and add it to the date selected in the calendar. I don't know of any popup calendar that will return both a date AND a time. You can input the time in a number of different ways. The simplest would be to have a textbox where the user types the time - for example, "9:30" or "18:15" or "4:40 pm". Another option would be to have a combo box listing selectable times in increments of, say 15 minutes, for the period of the day that is most likely required. So long as the combo box does not have the LimitToList property set, the user could type another time in, if the required one were not in the list. Another option would be to have two combo boxes to select hours and minutes, and maybe an option group to select am or pm. This form of time selection is used on many web pages, but personally, I find it extremely annoying and time-consuming to use. Once the time has been inputted or selected, you can add it to the selected date and store it. If you really want to have the date AND time returned by the popup calendar, then add your time selection control(s) to Allen's form, and change the code behind the OK button to add the time to the selected date before returning the result. -- Good Luck :-) Graham Mandeno [Access MVP] Auckland, New Zealand "Beeyen" wrote in message ... Good Day All, I have been attempting for days now various ways to include the time with the date to a field when using Allen Browne's popup calendar; similar to Now(). I have searched Google, Yahoo, Microsoft and the Discussion Groups. Surely, someone has done it or needed it. If you know how this can be accomplished, if you could graciously provide the instruction and coding, it will very much appreciated. Thanks |
#4
|
|||
|
|||
Time to Allen Browne' calendar
Hello Beeyen
I don't really understand what you are trying to do. If you want the date/time returned to be Now(), then why do you need a popup calendar at all? Do you want the user to select or enter a date and a time? If so, then you don't want to use Now() at all, except perhaps as a default starting value. I've just downloaded Allen's sample to look at, and I think you should try doing this: 1. Add a textbox to the form, under the calendar, named txtTime. 2. Set its Format to "HH:nn" and its Default Value to =Time() 3. Modify the cmdOk_Click code as follows: ' shows added or changed line Private Sub cmdOk_Click() Dim dt As Date ' On Error Resume Next 'Purpose: Transfer the result back to the calling text box (if there is one), and close. If Me.cmdOk.Enabled Then dt = Me.txtDate + TimeValue(Me.txtTime) ' If gtxtCalTarget = dt Then ' 'do nothing Else gtxtCalTarget = dt ' End If End If gtxtCalTarget.SetFocus DoCmd.Close acForm, Me.Name, acSaveNo End Sub You will need to enter the time in the text box before clicking OK. When you have that working, you can play around with other options for entering or selecting the time. By the way, make sure the textbox that is going to receive the result is formatted in such a way as to show both the date AND the time, for example, d-mmm-yyyy hh:nn If it is set, say, to "Short date" then you will only see the date part, even though the time is there as well. -- Good Luck :-) Graham Mandeno [Access MVP] Auckland, New Zealand "Beeyen" wrote in message ... Good Day Graham Mandeno Thank you for your patience, I have been working on this the past four days and I think perhaps I am getting closer. I chose the last option and have entered the Me.TxtDate = Now(). But what occurs when I select "OK" is the time flickers then the date is enters as usual. Would you have a suggestion as to where in the statement below I might place the correct coding for the time/date result? Let me know Thanks Private Sub cmdOk_Click() On Error Resume Next 'Purpose: Transfer the result back to the calling text box (if there is one), and close. If Me.cmdOk.Enabled Then If gtxtCalTarget = Me.txtDate Then Me.txtDate = Now() 'do nothing Else gtxtCalTarget = Me.txtDate End If End If gtxtCalTarget.SetFocus DoCmd.Close acForm, Me.Name, acSaveNo End Sub "Graham Mandeno" wrote: Hello Beeyen I have been trying to answer this question for you in another newsgroup - microsoft.public.access. Allen's calendar form returns only a date, with no time component. If you want the result to include a time as well, then you will need to input the time separately and add it to the date selected in the calendar. I don't know of any popup calendar that will return both a date AND a time. You can input the time in a number of different ways. The simplest would be to have a textbox where the user types the time - for example, "9:30" or "18:15" or "4:40 pm". Another option would be to have a combo box listing selectable times in increments of, say 15 minutes, for the period of the day that is most likely required. So long as the combo box does not have the LimitToList property set, the user could type another time in, if the required one were not in the list. Another option would be to have two combo boxes to select hours and minutes, and maybe an option group to select am or pm. This form of time selection is used on many web pages, but personally, I find it extremely annoying and time-consuming to use. Once the time has been inputted or selected, you can add it to the selected date and store it. If you really want to have the date AND time returned by the popup calendar, then add your time selection control(s) to Allen's form, and change the code behind the OK button to add the time to the selected date before returning the result. -- Good Luck :-) Graham Mandeno [Access MVP] Auckland, New Zealand "Beeyen" wrote in message ... Good Day All, I have been attempting for days now various ways to include the time with the date to a field when using Allen Browne's popup calendar; similar to Now(). I have searched Google, Yahoo, Microsoft and the Discussion Groups. Surely, someone has done it or needed it. If you know how this can be accomplished, if you could graciously provide the instruction and coding, it will very much appreciated. Thanks |
Thread Tools | |
Display Modes | |
|
|