Please help with this code

A

alvin Kuiper

Hi
I ahve this code:
Function hent()
username = ReturnUserName
Dim db As Database
Dim rs As Recordset
Dim rs2 As Recordset

Set db = CurrentDb()
'Set rs = db.OpenRecordset("undervisere")
strSQL2 = "Select * from tilmelding where behandlet = 0"
Set rs2 = db.OpenRecordset(strSQL2, dbOpenSnapshot)
Do While Not rs2.EOF
navn = rs2("navn")

adresse = rs2("adresse")
postnr = rs2("postnr")

strSQL = "SELECT * FROM kunder WHERE navn like '" & navn & "' and
adresse1 like '" & adresse & "' and postnummer like '" & postnr & "' "

Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)

If Not rs.EOF Then
Dim db3 As DAO.Database
Dim rs3 As DAO.Recordset
Set db3 = CurrentDb()
Set rs3 = db3.OpenRecordset("tilmelding")
rs3.Index = "kursusplanid"
rs3.Seek "=", rs2("kursusplanid")

rs3.Edit
rs3("kundenr") = rs("kundenummer")
rs3.Update

rs3.Close
End If
rs2.MoveNext
Loop
End Function
Its works fine when i use access alone but now i have my table on a sql
server
then i get error in :
rs3.Index = "kursusplanid"
rs3.Seek "=", rs2("kursusplanid")

What i do is look in a table after record where
behandlet = 0
then i look in another tabel to see if the same klient is in this table
are the klient in this table i want to update the first table whit a klientID
rs3.Edit
rs3("kundenr") = rs("kundenummer")
rs3.Update
hope someone can help
Alvin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top