Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with not in list

Status
Not open for further replies.

Lv2valt

Programmer
Aug 21, 2001
8
US
I have looked at every thread almost and tried them all. I am just tring to add items from a combo Box to a table and I keep getting a type missmatch function from all of the examples that I have found at: Set Db = CurrentDb
Set Rs = Db.OpenRecordset("Site_Info", DB_OPEN_TABLE) or Set Rs = Db.OpenRecordset("Site_Info", dbOpenDynaset)

Any Ideas?
 
Here it is. I was wondering if I might not have some library installed that I might need. Thanks for your help.

Dim Rs As Recordset
Dim Msg As String
Dim CR As String

CR = Chr$(13)


If NewData = "" Then Exit Sub


Msg = "'" & NewData & "' is not in the list." & CR & CR
Msg = Msg & "Do you want to add it?"
If MsgBox(Msg, vbQuestion + vbYesNo) = vbNo Then

Response = acDataErrContinue

MsgBox "Please try again."
Else


Set Rs = CurrentDb.OpenRecordset("Site_Info", dbOpenDynaset)

On Error Resume Next

Rs.AddNew


Rs![Installation Name] = NewData

Rs.Update

If Err Then

Response = acDataErrContinue

MsgBox Error$ & CR & CR & "Please try again.", vbExclamation
Else

Response = acDataErrAdded
End If
End If
 
In your code, I do not see where you declare a varible for your database object.

Dim db as Database

Add that with the other Dim statements.

Now just before you SET the recordset (Set rs = ...)
Set the database object.

Set db = CurrentDb

Then when you SET the recordset say...

Set Rs = db.OpenRecordset("Site_Info", dbOpenDynaset)

That's the only thing I can see with what you have shown us.


ljprodev@yahoo.com
ProDev, MS Access Applications B-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top