So I have a db that was working great (it's split on a server into a fe and be).
After a weekend, I found out that all the code in the database had been erased. Like, every last bit. So, I restored the code from a back up file and all was well (or so I thought).
I have code that updates a table through a combo box. This code and form work perfectly in a back up database I have, but is not working in the restored database. I even copied the forms over. I keep receiving a 'Compile Error: User-definted type not defined'.
I can't figure out why the code isn't functioning in the restored db but works great in the back up. The first line gets highlighted in yellow and "Dim rst As DAO.Recordset" gets highlighted in blue.
After a weekend, I found out that all the code in the database had been erased. Like, every last bit. So, I restored the code from a back up file and all was well (or so I thought).
I have code that updates a table through a combo box. This code and form work perfectly in a back up database I have, but is not working in the restored database. I even copied the forms over. I keep receiving a 'Compile Error: User-definted type not defined'.
I can't figure out why the code isn't functioning in the restored db but works great in the back up. The first line gets highlighted in yellow and "Dim rst As DAO.Recordset" gets highlighted in blue.
Code:
Private Sub Combo0_NotInList(NewData As String, Response As Integer)
Dim strMsg As String
Dim rst As DAO.Recordset
Dim db As DAO.Database
strMsg = "'" & NewData & "' is not in the list. "
strMsg = strMsg & "Would you like to add it?"
If MsgBox(strMsg, vbYesNo + vbQuestion, "Building_Number_PK") = vbNo Then
Response = acDataErrContinue
Else
Set db = CurrentDb()
Set rst = db.OpenRecordset("tblBuildingNumbers")
With rst
.AddNew
![Building_Numbers] = NewData
.Update
.Close
End With
Response = acDataErrAdded
End If
End Sub