Have a look at
http://www.able-consulting.com/ADO_Faq.htm#Q9
--
Andrew Grillage
http://www.concresco.com
Eden <Weldeab...cim-house.de> wrote in message
news:39096c1e$1...news.dev-archive.com...
>
> Dear Ado-Experts,
>
> I am using the following code to add Items to my Db,
> '********
> Public Function addItem(ByRef oItem As Item) As Boolean
> Dim strSql As String
> Dim tmpRs As Recordset
>
> addMA_FB = False
>
> strSql = "select * from Items"
> Set tmpRs = New Recordset
> If oDataLayer.GetConnectedRecordset(strSql, tmpRs, LT_Optimistic) Then
'Returns
> filled tmpRs
> With oItem
> tmpRs.AddNew
> tmpRs!Name = .Name
> tmpRs!Art = .Art
> tmpRs!Nr = .Nr
> tmpRs.Update
> tmpRs.Requery
> tmpRs.MoveLast
> --> .id = tmpRs!ITEM_ID ' here is the problem
> End With
> If oDatenZugriff.DisconnectRecordset(tmpRs) Then
> '// okay
> addItem = True
> Set tmpRs = Nothing
> End If
> End If
> End Function
>
> MOveLast doesnt shift the cursor to the last data , so I keep
> getting the wrong tmpRs!ITem_Id.
> Does anyone have an idea how I could do it better ?
> Thanx in advance!
> Eden.
andrewgrillage
| Sun, 11 Nov 2007 19:56:00 GMT |