+ Reply to Thread
Results 1 to 6 of 6

Problem accessing control in another form

  1. #1
    Forum Contributor
    Join Date
    07-07-2005
    Location
    England
    MS-Off Ver
    Office 2019 Enterprise
    Posts
    464

    Problem accessing control in another form

    hello,

    I have 2 forms one for basic stock item details and the other is the vb calender.

    When clicking the calender i would like it to populate my combobox "date1.text".

    when i am in my stock item form and i'm editing code i can press ctrl+spacebar and it will give me a list of valid objects (including my date1 box) but when i am editing the calender code all the boxes from my other form aren't there.

    Ultimately, when running the calender with "date1.text" in the code, there are errors.

    I am sure this is a schoolboy error and would appreciate some education!!

    thanks in advance for your help

    John

  2. #2
    Norman Jones
    Guest

    Re: Problem accessing control in another form

    Hi John,

    Do you have a reason for not putting the Calendar control in the same form
    as the ComboBox?

    Assuming that you do, in the Userform2's Calendar click event, add :

    UserForm1.Date1.Value = Me.Calendar1.Value


    ---
    Regards,
    Norman



    "johncassell" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > hello,
    >
    > I have 2 forms one for basic stock item details and the other is the vb
    > calender.
    >
    > When clicking the calender i would like it to populate my combobox
    > "date1.text".
    >
    > when i am in my stock item form and i'm editing code i can press
    > ctrl+spacebar and it will give me a list of valid objects (including my
    > date1 box) but when i am editing the calender code all the boxes from my
    > other form aren't there.
    >
    > Ultimately, when running the calender with "date1.text" in the code,
    > there are errors.
    >
    > I am sure this is a schoolboy error and would appreciate some
    > education!!
    >
    > thanks in advance for your help
    >
    > John
    >
    >
    > --
    > johncassell
    > ------------------------------------------------------------------------
    > johncassell's Profile:
    > http://www.excelforum.com/member.php...o&userid=25016
    > View this thread: http://www.excelforum.com/showthread...hreadid=391689
    >




  3. #3
    Forum Contributor
    Join Date
    07-07-2005
    Location
    England
    MS-Off Ver
    Office 2019 Enterprise
    Posts
    464
    Thanks for the reply Norman, I havent tried that code yet but sure it will work. I have a combobox which hopefully will call the calender when the drop-down button is clicked, I assumed that the calender had to be a separate form. Am i right in thinking this?

    Thanks again for the reply

  4. #4
    Norman Jones
    Guest

    Re: Problem accessing control in another form

    Hi John,

    > I assumed that the calender had
    > to be a separate form. Am i right in thinking this?


    No. Given your description, I would only use a single form.

    If you use a single form, the code line becomes:

    Me.Date1.Value = Me.Calendar1.Value

    ---
    Regards,
    Norman


    "johncassell" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > Thanks for the reply Norman, I havent tried that code yet but sure it
    > will work. I have a combobox which hopefully will call the calender
    > when the drop-down button is clicked, I assumed that the calender had
    > to be a separate form. Am i right in thinking this?
    >
    > Thanks again for the reply
    >
    >
    > --
    > johncassell
    > ------------------------------------------------------------------------
    > johncassell's Profile:
    > http://www.excelforum.com/member.php...o&userid=25016
    > View this thread: http://www.excelforum.com/showthread...hreadid=391689
    >




  5. #5
    Forum Contributor
    Join Date
    07-07-2005
    Location
    England
    MS-Off Ver
    Office 2019 Enterprise
    Posts
    464

    Calender control problem

    Yes that worked Norman... cheers , however I have a small problem. After the calender has put the date in my date box and i press enter, the calender pops up again, it also pops up if i use the mouse to move to the next box.

    Can you help with this please??

    Thanks again for replying

  6. #6
    Norman Jones
    Guest

    Re: Problem accessing control in another form

    Hi John,

    Post the userrform code.


    ---
    Regards,
    Norman



    "johncassell" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > Yes that worked Norman... cheers , however I have a small problem. After
    > the calender has put the date in my date box and i press enter, the
    > calender pops up again, it also pops up if i use the mouse to move to
    > the next box.
    >
    > Can you help with this please??
    >
    > Thanks again for replying
    >
    >
    > --
    > johncassell
    > ------------------------------------------------------------------------
    > johncassell's Profile:
    > http://www.excelforum.com/member.php...o&userid=25016
    > View this thread: http://www.excelforum.com/showthread...hreadid=391689
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1