Problem accessing control in another form

  • Thread starter Thread starter johncassell
  • Start date Start date
J

johncassell

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
 
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]...
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top