Page 1 of 2 12 LastLast
Results 1 to 15 of 29
  1. #1
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419

    select from pop up calendar on a form and choose a date

    and have this date (along with current time) that a user has chosen to be inputted onto the field of another table.
    how can this be done?
    I have problem with this issue before but never resolve it, so I came back and hoping to resolve it.

    I've created a user form, and created a date text field where I could just select a date from
    a calendar pop up, and wanted what I have chosen along with the current time to be inputted into a table.



    I could only have the chosen date inputted into the assigned table but not the time bc the pop up
    calendar doesn't give a time.

    Thanks, please let me know how this could be done. :-)

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    You want to pick any date but combine it with the current time? Very odd. And insert the value into a table that is not connected to the form? More odd.

    Can use an INSERT sql action if you want a new record or UPDATE sql action if you want to edit record.
    Last edited by June7; 11-13-2013 at 12:05 PM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    You want to pick any date but combine it with the current time?
    yes or pick a time, don't have to be a current time, and then store them in a table. Why is this odd?

    Can use and INSERT sql action if you want a new record or UPDATE sql action if you want to edit record.
    how would this select a date and time and store them into a table and this would be done in VBA right? :-)

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Just seems unusual to enter any date but use the current time. But now you say doesn't have to be current time.

    The INSERT or UPDATE would save the values entered into controls. Never seen a 'time picker' so guess have to just type into a textbox. Think can use input mask to help make sure the time is typed correctly.

    Yes, I would use VBA, like:

    CurrentDb.Execute "INSERT INTO table([DateTimeFieldname]) VALUES(#" & Me.DateBox & " " & Me.TimeBox & "#"

    or

    CurrentDb.Execute "UPDATE table SET [DateTimeFieldname] =#" & Me.DateBox & " " & Me.TimeBox & "# WHERE ID=" & Me.ID
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    But now you say doesn't have to be current time.
    yes sorry, I just thought about it that if a user just pick a date from the calendar, he/she could choose what ever date they want
    (it doesn't have to be the same date) but if is the current time, the time will be the same if the person enters the all the data at the same time.
    this is suppose to be data entry and I just want the user to have flexibility to choose the date and time, sorry about that.

    CurrentDb.Execute "INSERT INTO table([DateTimeFieldname]) VALUES(#" & Me.DateBox & " " & Me.TimeBox & "#"
    so we would do this in the combo box in the event tab, on click/ before update/ after update?


    do you know that if we could set the user to have them select a time from a pop up the way they are able to select a date pop from a calendar?

    Never seen a 'time picker' so guess have to just type into a textbox. Think can use input mask to help make sure the time is typed correctly
    this seems that it makes the user able to type in a time in the userform and have a input mask to help with not entering a mistaken time right?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Use whatever event suits your situation, probably a button click.

    I've never seen a 'time picker' popup. If you limited the time choices to whole hour or 15-minute intervals, could create a combobox with those choices, otherwise, use textbox with input mask.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    use textbox with input mask.
    input mask only have either date or time, not both, so if I want to have a field that have the date and time, how do I use input mask?

    Use whatever event suits your situation, probably a button click.
    so if I preferred user to select a date and time (not current time) then I can't use VBA. but if I have random time or current time I probably could, right?

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    I use input mask for date: 99/99/"20"00;0;

    I've never had to deal with time entry.

    Don't understand the last question. Why would it matter to VBA how the date/time is entered?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    Why would it matter to VBA how the date/time is entered?
    because VBA doesn't allow you to choose a time you like out of the 24 hour time frame,
    the way a calendar pop up allows user to choose a date.

    But a VBA can choose the current time, or a random time if you code it to do it, that is what I meant.

    I've never had to deal with time entry.
    so if you have a field that you want to have the date and time, then how do you use input mask?

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    Ok, this input mask 00/00/0000\ 00:00\ >LL that I tried and this one 99/99/0000\ 99:00:00\ >LL;0;_

    Both are not correct, I kept getting error message. I only put input mask on the form side and I think that blog is doing that too.

    This one that I designed myself 99/99/"20"00\ 00:00\ LL is giving the same error message.

    Maybe I am not going to use input mask because is giving some problems. :-)

    99/99/"20"00;0;
    your date input mask seems to have no problem, no error that I see and it works fine.

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    This one seems to work okay:

    99/99/"20"00" "99:99" "L"M";0;_
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #13
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    Quote Originally Posted by June7 View Post

    99/99/"20"00" "99:99" "L"M";0;_
    cool, how you figure that out? you are pretty smart.
    I looked at it and understand most of what is going on,

    "20" is what is going to appear,
    " " - between the 00 and 99 is the space
    " " - between the 99 and L is also a space
    L is a letter that is required from A to Z.
    M is the letter that you put there.

    so what does this
    ;0;_
    do?

  14. #14
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616
    Have you thought of using the conversion functions ? You may be able to manipulate using them to suit your requirements.
    Below are results from immediate window.
    Code:
    ?CDbl(Now())
     41592.4202893519 
    ?CDbl(Date())
     41592 
    ?CDbl(Time())
     0.42056712962963 
    ?CDate(41592.42056712962963)
    14/11/2013 10:05:37
    If users pick date and you can add current time to it by using
    CDate(CDbl(YourDateBox) + CDbl(Time()))

  15. #15
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    If users pick date and you can add current time to it by using
    CDate(CDbl(YourDateBox) + CDbl(Time()))
    so that means the date that the user picked is then stored in a variable in procedure and then have the current time add to it?
    But I also think is better that the user can pick or type a date and time so that way it doesn't have to be the current time, because if someone
    is to do data entry they would be limited to the current time otherwise.

    the input mask is a good idea but I think if there is a date and time selection it would be much more better and productive because typing
    in the date and time are a tedious task.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Calendar Button to Select Dates
    By CementCarver in forum Forms
    Replies: 9
    Last Post: 04-20-2013, 09:15 AM
  2. Choose the row with the MOST RECENT date
    By taimysho0 in forum Queries
    Replies: 1
    Last Post: 05-14-2012, 02:35 PM
  3. Using form combo box in query to select date.
    By LordNecro in forum Access
    Replies: 2
    Last Post: 04-14-2012, 05:09 AM
  4. Custom calendar - select multiple dates
    By larek in forum Access
    Replies: 6
    Last Post: 06-23-2011, 02:40 AM
  5. Set Calendar to default to today's date
    By RickM in forum Access
    Replies: 1
    Last Post: 02-22-2009, 04:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums