ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem accessing control in another form (https://www.excelbanter.com/excel-programming/335991-problem-accessing-control-another-form.html)

johncassell[_17_]

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


--
johncassell
------------------------------------------------------------------------
johncassell's Profile: http://www.excelforum.com/member.php...o&userid=25016
View this thread: http://www.excelforum.com/showthread...hreadid=391689


Norman Jones

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"
wrote in message
...

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




johncassell[_18_]

Problem accessing control in another form
 

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


Norman Jones

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"
wrote in message
...

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




johncassell[_19_]

Problem accessing control in another form
 

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

Can you help with this please??

Thanks again for replyin

--
johncassel
-----------------------------------------------------------------------
johncassell's Profile: http://www.excelforum.com/member.php...fo&userid=2501
View this thread: http://www.excelforum.com/showthread.php?threadid=39168


Norman Jones

Problem accessing control in another form
 
Hi John,

Post the userrform code.


---
Regards,
Norman



"johncassell"
wrote in message
...

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





All times are GMT +1. The time now is 04:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com