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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Continuing calendar thoughts

Status
Not open for further replies.

ChrisTheAncient

Technical User
Dec 22, 2002
169
GB
I did have a thread earlier with calendar problems...

thread702-713204

which gave me some food for thought.

But I'm not one to let go (too much) sometimes - when I really get stuck into it.

Further research in the forum found me...

thread702-595839

where there is a nice little calendar building routine.

Currently, I have built the calendar and can display and change months a piece of cake. But, where I am having a problem is with the date selected in a text box routine.

I am running AccessXP and I keep getting "object doesn't support this property or method" on the selday line.

Obviously, I am using this little bit of code extremely wrongly! How should I use it please?

TIA

Chris

*************************************
OK, I'm stoopid. But I'm good at it!
*************************************
 
Hi, Chris -

I believe the line of code in question:

Code:
selday = val(me.activecontrol.value)

should be:

Code:
selday = val(screen.activecontrol.value)

And here's another thread on a calendar solution:

Thread702-677858

And a link to another forum that has a little calendar example to download:


HTH,

Ken S.
 
Hi Ken

Sorry for the delay getting back - I was forced into going to eat and drink!

Rather late at night in my neck of the woods now (UK time), so I'll have an investigate of your solution and ideas tomorrow. I'll feed back then.

Thanks

Chris

*************************************
OK, I'm stoopid. But I'm good at it!
*************************************
 
Hi, Chris, another link for you to check out...

FAQ702-639

Ken S.
 

Good morning Ken.

I'm obviously doing something quite wrong with that calendar! Changing Me to Screen still gave the same fault!

The referee-assistant calendar I had found with the search in this forum, but it didn't seem to do that much form me.

I've had a quick chance to look at the utteraccess one and that looks as though it has things that seem to head my way a bit. I'm going to look deeper into that during the course of a while. I'm out quite a bit today, so I won't get much chance. But I will feedback.

Thanks

Chris


*************************************
OK, I'm stoopid. But I'm good at it!
*************************************
 
Hi, Chris -
I looked into the ActiveControl problem a bit more. ActiveControl *is* a property of both the form object and the screen object, so either Me.ActiveControl or Screen.ActiveControl should be valid. I don't know why your code is bombing, I tested it in a little procedure and could not reproduce your results. Can you post the whole routine?

Ken S.
 
The whole routine is as given in the thread, but here's my copies - sl;ightly modified to the way I use variable names...

The form code...

Option Compare Database
Option Explicit


Private Sub Command64_Click()

Dim intSelDay As Integer, vDateSel As Variant

intSelDay = Val(Me.ActiveControl.Value)
vDateSel = DateSerial(Year(Me![txtFirstDate]), Month(Me![txtFirstDate]), intSelDay)

End Sub

Private Sub Form_Open(Cancel As Integer)

Me![txtFirstDate] = Date
Call FillDates

End Sub

Private Function FillDates()

Dim CurDay As Variant, CurBox As Integer

CurDay = DateSerial(Year(Me![txtFirstDate]), Month(Me![txtFirstDate]), 1)
CurDay = DateAdd("d", 1 - Weekday(CurDay), CurDay)

For CurBox = 0 To 41
Me("D" & CurBox) = Day(CurDay)
Me("D" & CurBox).Visible = False
If Month(CurDay) = Month(Me!txtFirstDate) Then Me("D" & CurBox).Visible = True
CurDay = CurDay + 1
Next CurBox

End Function

Private Sub MonthDown_Click()

Me!txtFirstDate = DateAdd("m", -1, txtFirstDate)
Call FillDates

End Sub

Private Sub MonthUp_Click()

Me!txtFirstDate = DateAdd("m", 1, txtFirstDate)
Call FillDates

End Sub


*************************************
OK, I'm stoopid. But I'm good at it!
*************************************
 
Jerome

Did have a look there. It's the same calendar that Neil offered me.

Neil

PM on the way. Great stuff. Very powerful looking and I will have to probe a lot deeper into that one.

Chris


*************************************
OK, I'm stoopid. But I'm good at it!
*************************************
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top