<I imported form, reports- table and queries to another database.>
What format database was the source, and what format was the target?
Access 2003-->Access 2003?
Access 2003-->Access 2007?
Access 2007-->Access 2003?
Access 2007-->Access 2007?
Did you import them into a blank, new database?
Did you run the compact Repair utility before the import in the source DB, ...and then in the target DB, after the import?
Did you compile the code in the target, after the import? (in the VBA Editor click: Debug-->Compile)
Let's also redo some of the code:
'
Private Sub cboCompany_NotInList(NewData As String, Response As Integer)
Dim db As DAO.Database
Dim rstcboCompany As DAO.Recordset
Dim sqltblCompany As String
Set db = CurrentDb()
'Suppress the default error message.
Response = acDataErrContinue
' Prompt user to verify if they wish to add a new value.
If MsgBox("The company of " & NewData & " is not in list. Add it?", vbYesNo) = vbYes Then
' Set Response argument to indicate that data is being added.
'Open a recordset of the tblCompany Table.
sqltblCompany = "Select * From tblCompany "
Set rstcboCompany = db.OpenRecordset(sqltblCompany, dbOpenDynaset)
'Add a new Company with the value that is stored in the variable NewData.
rstcboCompany.AddNew
rstcboCompany![CompanyName] = NewData
rstcboCompany.Update
'Inform the combo box that the desired item has been added to the list.
Response = acDataErrAdded
End If
'Cleanup
rstcboCompany.Close
Set rstcboCompany = Nothing
db.Close
Set db = Nothing
End Sub
'
Now insert this, Compile the code (in the VBA Editor click: Debug-->Compile) and give it a whirl...
Let us know the results.
;-)
JeffCoachman