Fareon
03-21-2005, 12:06 PM
I am making a program for me to learn how to use databases. I am currently using a Microsoft Access database and I get the error, "User-defined Type not defined" when I try to compile my VB program. The code for it is:
Private Sub cmdexit_Click()
Unload frmenter
End Sub
Private Sub Form_Load()
'Change Location of Form to Fit Screen
frmenter.Width = Screen.Width / 3
frmenter.Height = Screen.Height / 2
frmenter.Top = Screen.Width / 8
frmenter.Left = Screen.Height / 3
'Check to see if any classes exsist
Dim MyConn As ADODB.Connection
Dim MyRecSet As ADODB.Recordset
Dim intClasses As Integer
Dim strAddress As String
Dim strPhone As String
Set MyConn = New ADODB.Connection
MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Common Files\marks program\dbmarks.mdb;"
MyConn.Open
Set MyRecSet = MyConn.Execute("SELECT COUNT(*) as class1 FROM classes")
intClasses = MyRecSet.Fields.Item("class1").Value
MyConn.Close
If intClasses > 0 Then
frmenter.cmdeditclass.Enabled = True
End If
End Sub
It is a program that teachers could use to keep the marks of their students in. That is all I have so far and the error comes from this line
Dim MyConn As ADODB.Connection
Private Sub cmdexit_Click()
Unload frmenter
End Sub
Private Sub Form_Load()
'Change Location of Form to Fit Screen
frmenter.Width = Screen.Width / 3
frmenter.Height = Screen.Height / 2
frmenter.Top = Screen.Width / 8
frmenter.Left = Screen.Height / 3
'Check to see if any classes exsist
Dim MyConn As ADODB.Connection
Dim MyRecSet As ADODB.Recordset
Dim intClasses As Integer
Dim strAddress As String
Dim strPhone As String
Set MyConn = New ADODB.Connection
MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Common Files\marks program\dbmarks.mdb;"
MyConn.Open
Set MyRecSet = MyConn.Execute("SELECT COUNT(*) as class1 FROM classes")
intClasses = MyRecSet.Fields.Item("class1").Value
MyConn.Close
If intClasses > 0 Then
frmenter.cmdeditclass.Enabled = True
End If
End Sub
It is a program that teachers could use to keep the marks of their students in. That is all I have so far and the error comes from this line
Dim MyConn As ADODB.Connection