Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Copy Field Values between forms

    A form opens on click from the main form. How do I get the value from the txtDate field in the main form automatically put into the txtDate field of the form that opens on click?

  2. #2
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Tennessee
    Posts
    194
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy Field Values between forms

    in the open event of the new form put
    txtdate = forms![main form]!txtdate
    if main form is the name of the first form

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy Field Values between forms

    Thanks. I did that, but I got a runtime error '2448'. I guess it has to do with the fact I'm working with a Calendar Control, which I've never done.

    Thanks again.

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Calendar Control

    Which calendar control are you using and which form is it on, the one you're clicking or the one you want the value transferred to? ActiveX Controls don't have the same properties as other forms and controls, so you need to provide more information to get the help you need.
    Charlotte

  5. #5
    2 Star Lounger
    Join Date
    Feb 2001
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calendar Control

    I'm using the Calendar Control 9.0 ActiveX control. I want to click on a date on this and have another form open with the date clicked on the control automatically entered in the Date field.

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Calendar Control

    OK, here's some code I threw into a form with a calendar control on it:<pre>'holds ref to calendar control 9.0
    Private WithEvents oCalendar As Calendar

    '========================
    Private Sub Form_Close()
    'destroy the object variable
    Set oCalendar = Nothing
    End Sub 'Form_Close()


    '========================
    Private Sub Form_Open(Cancel As Integer)
    'instantiate the calendar control object
    Set oCalendar = Me.ActiveXCtl0.Object
    End Sub 'Form_Open(Cancel As Integer)


    '========================
    Private Sub oCalendar_Click()
    MsgBox oCalendar.Value
    End Sub 'oCalendar_Click()</pre>

    If you declare and instantiate your control this way, intellisense will give you the valid methods and properties of the control when you type "oCalendar.", and that should help you with this. I just put in the Click event in order to demonstrate how to retrieve the value from the control. You could put your code in that event to pop up the other form.
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •