T
Tony Piperato
Can someone please tell me why I receive the error "Compile Error: User
defined type not defined" on line number 5 below when I try to compile the
following:
Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
' Use an InputBox to retrieve user input
' for a custom search using the FindFirst
' and BuildCriteria methods.
Dim dbMyDB As Database (I RECEIVE THE ERROR FOR THIS LINE!)
Dim rsMyRS As Recordset
Dim strInput As String
Dim strCriteria As String
Dim strMsg As String
Dim txtDateStart As Control
Dim txtDateEnd As Control
Dim txtNoneFound As Control
Set dbMyDB = CurrentDb
Set rsMyRS = dbMyDB.OpenRecordset _
("ProductUse_QRY", dbOpenDynaset)
strMsg = "Enter the start date"
' Prompt user for input.
strInput = InputBox(strMsg)
' Build a criteria string.
strCriteria = BuildCriteria("DateStart", dbText, strInput)
' Apply the criteria to the FindFirst method.
rsMyRS.FindFirst strCriteria
' Make sure a record was found.
If Not (rsMyRS.NoMatch) Then
txtDateStart = rsMyRS("DateStart")
txtDateEnd = rsMyRS("EndStart")
Debug.Print rsMyRS("DateStart") & " " & _
rsMyRS("DateEnd")
Else
txtNoneFound = "No matching records were found."
Debug.Print "No matching records were found."
End If
rsMyRS.Close
dbMyDB.Close
End Sub
Thanks in advance.
AKP
defined type not defined" on line number 5 below when I try to compile the
following:
Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
' Use an InputBox to retrieve user input
' for a custom search using the FindFirst
' and BuildCriteria methods.
Dim dbMyDB As Database (I RECEIVE THE ERROR FOR THIS LINE!)
Dim rsMyRS As Recordset
Dim strInput As String
Dim strCriteria As String
Dim strMsg As String
Dim txtDateStart As Control
Dim txtDateEnd As Control
Dim txtNoneFound As Control
Set dbMyDB = CurrentDb
Set rsMyRS = dbMyDB.OpenRecordset _
("ProductUse_QRY", dbOpenDynaset)
strMsg = "Enter the start date"
' Prompt user for input.
strInput = InputBox(strMsg)
' Build a criteria string.
strCriteria = BuildCriteria("DateStart", dbText, strInput)
' Apply the criteria to the FindFirst method.
rsMyRS.FindFirst strCriteria
' Make sure a record was found.
If Not (rsMyRS.NoMatch) Then
txtDateStart = rsMyRS("DateStart")
txtDateEnd = rsMyRS("EndStart")
Debug.Print rsMyRS("DateStart") & " " & _
rsMyRS("DateEnd")
Else
txtNoneFound = "No matching records were found."
Debug.Print "No matching records were found."
End If
rsMyRS.Close
dbMyDB.Close
End Sub
Thanks in advance.
AKP