Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Back to Access Forum    Comments List
Upload Images | @Reply | Bookmark | Link | Email | Next Unseen |
Simple Date Picker
Chris Pardy 
   
4 years ago
Hi,

I created a simple Date picker form that has an unbound Date txt box.

From my script on another form, I want to open the date picker form, let the user select the date, then feed that date into a variable, close the date picker form and continue the original script.

I can open the date picker form just fine... I just don't know how i would pause the progress in the script while the user selects the date from the date picker form.
Adam Schwanz  @Reply  
           
4 years ago
You could just open the date picker form and then put the rest of the script into the on close event of the date picker form.
Chris Pardy OP  @Reply  
   
4 years ago
Hi Adam,

Thanks for the reply, I am currently trying that approach.. but running into problems because I need to get a handful of variables that were from the first form into the script on the datepicker form.
Chris Pardy OP  @Reply  
   
4 years ago
if it is helpful.. here is my code :

Private Sub btnToggleStatus_Click() 'updated the IssueStatus, ResolvedDate, and Issue Notes for the current Issue

Dim CurrentID As Integer 'ID of the current issue from tblEventElementIssue
Dim i As Integer ' value in the IssueStatus field
Dim tLU As Integer 'lookup the ID from tblType that the typename matches "Unresolved"
Dim tLR As Integer 'lookup the ID from tblType that the typename matches "Resolved"
Dim User As String ' Username for use in updating notes
Dim Status As String ' lookup of TypeName based on the ID stored in IssueStatus
Dim R As Integer ' Current Record
Dim rD As Date ' resolved date
Dim t As String ' issue name from qry


CurrentID = txtEventElementIssueID.Value
R = Me.CurrentRecord
tLU = Nz(DLookup("TypeID", "tblType", "TypeName='Unresolved'"), "")
tLR = Nz(DLookup("TypeID", "tblType", "TypeName='Resolved'"), "")
User = wsGetUserName() & " Updated Status to: "
rD = [Forms]![frmShowReport]![EventDate] ' sets rd to the date of the currently selected event day
t = title.Value


    If IssueStatus.Value = tLU Or IsNull(IssueStatus) Then
        If MsgBox("Please confirm that the Issue: " & vbCrLf & t & vbCrLf & "Was resolved on: " & Format(rD, "dddd dd-mmm-yy") & vbCrLf & vbCrLf & "Choose ""NO""" & " to choose another Date", vbYesNo, "Important!") = Yes Then
            
        IssueStatus.Value = tLR
        i = Nz(IssueStatus.Value, 0)
        ResolvedDate.Value = rD
        ResolvedBy.Value = wsGetUserName()
        
        Status = DLookup("TypeName", "tblType", "TypeID=" & i)
        
        CurrentDb.Execute "INSERT INTO tblEventElementIssueNotes (EventElementIssueID, NoteText, CreatedBy) " & _
            "VALUES (""" & CurrentID & """,""" & User & Status & """, """ & wsGetUserName & """)"
            
        Else
        
        DoCmd.OpenForm "frmResolvedDatePicker"
        
        'in this instance, the IssueStatus and Issue Notes need to be updated after the date has been picked by the user and Confirmed via
        'frmResolvedDatePicker btnDateConfirm
        
        Exit Sub
            
        End If
            
   ElseIf IssueStatus.Value = tLR Then
  
        IssueStatus.Value = tLU
        i = Nz(IssueStatus.Value, 0)
        ResolvedDate.Value = rD
        ResolvedBy.Value = wsGetUserName()
        
        Status = DLookup("TypeName", "tblType", "TypeID=" & i)
        
        CurrentDb.Execute "INSERT INTO tblEventElementIssueNotes (EventElementIssueID, NoteText, CreatedBy) " & _
            "VALUES (""" & CurrentID & """,""" & User & Status & """, """ & wsGetUserName & """)"
  
  
   End If
  
    Me.Requery
    DoCmd.GoToRecord , , acGoTo, R
    If CurrentProject.AllForms("frmShowReport").IsLoaded Then
    Forms![frmShowReport]![frmUnresolvedtIssueList].Requery
    End If
    
    If CurrentProject.AllForms("frmIssueList").IsLoaded Then
    Forms![frmIssueList].Requery
    End If
    
End Sub
Chris Pardy OP  @Reply  
   
4 years ago
what I am trying to do is in the "else" section of the msgbox if statement..
is esentially this block of code :
  IssueStatus.Value = tLR
        i = Nz(IssueStatus.Value, 0)
        ResolvedDate.Value = rD
        ResolvedBy.Value = wsGetUserName()

where rD = a date that is picked by the user.
Jeffrey Eckert  @Reply  
     
4 years ago
This may not be the best approach, but I've run into a similar problem...I had a generic payment form open that can be called from several different forms.  I wanted the form that called it to wait for the user to submit a payment before continuing on with the script in the original form.  I used TempVars to pass variables between the forms.  To make the original procedure wait for input, i used the following:

Do Until Not CurrentProject.AllForms("NameOfForm").IsLoaded
    Do Events
Loop

That had the procedure wait for the payment form to be closed by the user before it continued on, and i used TempVars to pass information to and from the Payment form.
Chris Pardy OP  @Reply  
   
4 years ago
Hi Jeffery, thanks for the reply. this is just what I needed! except instead of using TempVars, I had the date picker form set a global variable that I could then pick up from the original form.
Jeffrey Eckert  @Reply  
     
4 years ago
Glad I could help!  Personally, I prefer TempVars over global variables only because if you have an unhandled error, a global variable may lose its value.  But that's just my opinion.  :)

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
 
What's This?

 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 10/11/2026 10:32:14 PM. PLT: 1s