Access 2007 automatically uses DAO 3.6 when you open an MDB, and ACE when
you open an ACCDB. However, both libraries are known as DAO within VBA code.
Therefore your code will work without the need to force it.
You can verify that by opening an ACCDB. Open the Immediate Window (Ctrl+G),
and enter:
? References("DAO").FullPath
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"bobdydd" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> Hi Everybody
>
> I am currently updating a 2000.mdb to a 2007.accdb and I am trying to
> use the 3.6 DAO Object Library in the tools>references in the vb
> editor. This produces an error "Name conflict with an Existing
> Library" and yet I need this to run the following code.
>
> I have a combo property set to "Limit to List" and on the "not in list
> property" the following code needs to run
>
> Any help gratefully received
>
> Dim strMsg As String
> #If USEDAO Then
> Dim rst As DAO.Recordset
> Dim db As DAO.Database
> #Else
> Dim rst As ADODB.Recordset
> #End If
>
> strMsg = "'" & NewData & "' is not in the list. "
> strMsg = strMsg & "Would you like to add it?"
> If vbNo = MsgBox(strMsg, vbYesNo + vbQuestion, _
> "New Method") Then
> Response = acDataErrDisplay
> Else
> #If USEDAO Then
> Set db = CurrentDb()
> Set rst = db.OpenRecordset("xtblCustomerPaidMethod")
> #Else
> Set rst = New ADODB.Recordset
> rst.Open _
> Source:="xtblCustomerPaidMethod", _
> ActiveConnection:=CurrentProject.Connection, _
> CursorType:=adOpenKeyset, _
> LockType:=adLockOptimistic, _
> Options:=adCmdTableDirect
> #End If
> rst.AddNew
> rst("Data") = NewData
> rst.Update
> Response = acDataErrAdded
> rst.Close
> End If
>