Visual Basic

Discussion in 'Programming' started by novashun, Mar 30, 2009.

  1. #1
    Can anyone help me with this code? Im implementing a calendar into a Access form, and the calendar does not hide nor does it activate when clicked on. It just stays there on the right side of the field on the form. Initial Contact Date is the date, we built an Event for Calendar 5 to pop up so the user can select the date and it will fill the field. Anyone?


    Private Sub Initial_Contact_Date_Click()
    Initial_Contact_Date = Calendar5.Value
    Initial_Contact_Date.SetFocus
    Calendar5.Visible = False
    End Sub

    Private Sub Initial_Contact_Date_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Calendar5.Visible = True
    Calendar5.SetFocus
    End Sub
     
    novashun, Mar 30, 2009 IP
  2. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #2
    Where is Calendar5 defined ? why are making it invisible at first place ?
     
    it career, Mar 31, 2009 IP
  3. novashun

    novashun Well-Known Member

    Messages:
    821
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    138
    #3

    Defined in the old date text box. We put a compbo box in there so it could become clickable for the calendar to display for a date fill.
    whats supposed to happen is when the date field is clicked on , the calendar pops up, allows user to push date, and then hides again.

    Its hidden in the beginning until clicked- then select date, then hides after date fills field.
     
    novashun, Mar 31, 2009 IP
  4. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #4
    I'm not sure exactly what controls you are using, but do you have it around the wrong way? is what you mean to do this:

    
    Private Sub Initial_Contact_Date_Click()
    Calendar5.Visible = True
    Calendar5.SetFocus
    End Sub
    
    Private Sub Calendar5_Click() 
    Initial_Contact_Date = Calendar5.Value
    Calendar5.Visible = False
    End Sub
    
    Code (markup):
     
    camjohnson95, Mar 31, 2009 IP
  5. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #5
    you would also have to set Calendar5.Visible = False either at design or run-time (in the Form_Load event)
     
    camjohnson95, Mar 31, 2009 IP
  6. DirectoryDude

    DirectoryDude Member

    Messages:
    371
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    35
    #6
    also, you might want to call the "refresh" method
     
    DirectoryDude, Apr 4, 2009 IP