Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calendar Control Problem 1

Status
Not open for further replies.

txaccess

Technical User
Jul 21, 2004
91
0
0
US
This is an interesting one. On a form with a dat field, I have included a Command button that opens a Celendar form. The user selects the date and the Calendar populates the field. It worked great until I put the form onto a tab control and now an error msg pops up saying that the method is not supported.

My technique for achieving the above is when the Calendar opens, the record source is set to the same as the originating form. Also a value e.g. 1 is passed to the Calendar to tell it what to do with the result using a Select Case statement. The code to bring back the date is the part that mysteriously is not working on a tab control. Any thoughts?

PS, I have tried referencing the tab control in the code but that did not work either.

Thanks

I haven't failed, I have just found 10,000 ways that it won't work!
 
Hi,

I've definitely seen this error within tek-tips, and it is to do with referencing correctly.

Sorry - I can't remember solution, but the same error is in here.

Try a bit more searching.

ATB

Darrylle

Never argue with an idiot, he'll bring you down to his level - then beat you with experience. darrylles@yahoo.co.uk
 
Thanks Darrylles

I have searched but can find nothing on the subject relating to the Calendart control on a form on a Tab Control. I think my problem is the correct referencing of the Tab Control. My referencing code is something like this:

Forms!main_frm!tab_cntrl!sub_frm!Form!date_field

I have tried referencing & not referecing the Tab Control. I have also tried referecing the actual tab on the Tab control such as;

Forms!main_frm!tab_cntrl!tab_name!sub_frm!Form!date_field

But that does not work either. I think that I just do not know the syntax for referencing a field that is on a form on a tab!

I haven't failed, I have just found 10,000 ways that it won't work!
 
The actual statement to return the date value is:

Case 2
Forms!T_main_tab!M_tab_cntrl!activity_tab!M_frm_activity!Form! = Me.Calendar0.Value

The error message is

"Property let procedure not defined and property get procedure did not return an object"

If I remove M_tab_cntrl, then the error "Object or property not supported" is returned.

I haven't failed, I have just found 10,000 ways that it won't work!
 
It appears you may have left the "Page" reference out.

txtDate = Forms("Form1").Controls("Tab1").Pages("Page1").Controls("Calendar0")

This worked for me, just fill in the proper form, tab, page & control names.

Good Luck!
 
Just a suggestion to try to cut down on hardcoding the return value from the calendar.
You could set the focus to the control that has the date field before opening the calendar form and send the value of that control as the openargs for the calendar form. When the date is selected on the calendar you could return the value to the active control on the screen. something like this
Code:
Private Sub ctlCalendar_Click() 
Dim sDate As String 
'set variable to selected date
sDate = ctlCalendar.Value 
'close calendar form
DoCmd.Close
'set active control on the screens value to the variable
Screen.ActiveControl.Value = sDate 
End Sub

'when opeing calendar control
txtDate.SetFocus 
DoCmd.OpenForm "Calendar", , , , , acDialog, txtDate.value

just something I have used to make a popup calendar form a bit more dynamic so I dont have to hardcode all the place to return the values to.

~Tatum~
 
Thanks Tatum, I appreciate your input. I will try that idea out today.

I haven't failed, I have just found 10,000 ways that it won't work!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top