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

Access Calendar Application 1

Status
Not open for further replies.

jdgreen

Technical User
Mar 21, 2001
144
US
I have a Calendar application (found it here and modified it for my use) that when I import the tables, forms and modules into a new database it starts giving me a "Compile error: Method or data member not found" Here is the code:

Option Compare Database
Option Explicit

Public db As Database
Public rs As Recordset

Private mCal As Form

Function Cal(mo, yr)
Dim i As Integer
Dim DayOne, WorkDate, Offset
Set mCal = Forms!frmCalender

mCal!month.SetFocus
mo = mCal!month
yr = mCal!year

For i = 1 To 37
mCal("Day" & i + Offset).Visible = False
mCal("Text" & i + Offset).Visible = False
mCal("date" & i + Offset) = Null
mCal("day" & i + Offset) = Null
Next

DayOne = DateValue(mo & "/1/" & yr)
WorkDate = DayOne
Offset = WeekDay(DayOne) - 1

For i = 1 To LenMonth(DayOne)
mCal("Day" & i + Offset).Visible = True
mCal("Text" & i + Offset).Visible = True
mCal("date" & i + Offset) = WorkDate
mCal("day" & i + Offset) = i
WorkDate = WorkDate + 1
Next

Call PutInData
End Function
Function LenMonth(d)
Dim Start, Finish

Start = DateValue(month(d) & "/1/" & year(d))
Finish = DateAdd("m", 1, Start)
LenMonth = Finish - Start
End Function
Function SendToInputBox(mynum)
Dim strDate As String
strDate = Format(mCal("Date" & mynum), "dddd mmmm d, yyyy")

DoCmd.OpenForm "frmInputBox"

With Forms!frmInputBox
!InputDay = mynum
!InputDate = mCal("Date" & mynum)
!InputFor = strDate
!original_text = mCal("Text" & mynum)
!InputText = mCal("Text" & mynum)
!InputText.SetFocus
SendKeys "{F2}^{HOME}", False
End With
End Function
Public Sub PutInData()
Dim strSQL As String
Dim i As Integer

For i = 1 To 37
mCal("text" & i) = Null
Next i

strSQL = "SELECT * FROM [tblInput] WHERE ((MONTH(InputDate) = " & mCal!month & " AND YEAR(InputDate) = " & mCal!year & ")) ORDER BY InputDate;"

Set db = CurrentDb()
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)

If rs.RecordCount > 0 Then
For i = 1 To 37
If IsDate(mCal("date" & i)) Then
rs.FindFirst "inputdate=#" & mCal("date" & i) & "#"
If Not rs.NoMatch Then
mCal("text" & i) = rs!InputText
End If
End If
Next i
End If
End Sub

The red colored area is highlighted in Yellow when it debugs and the green area is highlighted in blue.

John Green
 
Try to replace this:
Public rs As Recordset
with this:
Public rs As DAO.Recordset

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I knew it had to be something simple. Thank you.

John Green
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top