associates
IS-IT--Management
Hi,
I have got a compiler error that says user-defined type not defined. What happens is i've got a code from a website that shows how to create a calendar and when user
choose a date from the calendar window, it would appear on the textbox automatically. That's cool. However, i created a new database for testing purpose only and copy and paste the code on to it. It worked with no problem. The problem occured after having put the code onto the real database that i want it to be, it doesn't work. It says compiler error. User-defined type not defined. It's actually highlighting the line where it's got
"Dim db As DAO.Database".
Here is the code:
Private Function GetProperty(ByVal strPropName As String, ByRef strPropValue As Variant) As Boolean
Const cProcedureName As String = "GetProperty"
On Error GoTo Err_Handler
Dim db As DAO.Database
Set db = CurrentDb
strPropValue = db.Properties(strPropName)
GetProperty = True
Exit_Sub:
On Error GoTo 0
Set db = Nothing
Exit Function
Sorry for asking this silly question. I realised that there is no such thing as DAO.
The strange thing is that why it works on the dummy database but not the other one. I have made sure that i copied and pasted exactly everything. Correct me if i'm wrong.
I'd be grateful if anyone might be able to help me solve this.
Thank you in advance
I have got a compiler error that says user-defined type not defined. What happens is i've got a code from a website that shows how to create a calendar and when user
choose a date from the calendar window, it would appear on the textbox automatically. That's cool. However, i created a new database for testing purpose only and copy and paste the code on to it. It worked with no problem. The problem occured after having put the code onto the real database that i want it to be, it doesn't work. It says compiler error. User-defined type not defined. It's actually highlighting the line where it's got
"Dim db As DAO.Database".
Here is the code:
Private Function GetProperty(ByVal strPropName As String, ByRef strPropValue As Variant) As Boolean
Const cProcedureName As String = "GetProperty"
On Error GoTo Err_Handler
Dim db As DAO.Database
Set db = CurrentDb
strPropValue = db.Properties(strPropName)
GetProperty = True
Exit_Sub:
On Error GoTo 0
Set db = Nothing
Exit Function
Sorry for asking this silly question. I realised that there is no such thing as DAO.
The strange thing is that why it works on the dummy database but not the other one. I have made sure that i copied and pasted exactly everything. Correct me if i'm wrong.
I'd be grateful if anyone might be able to help me solve this.
Thank you in advance