Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / November 2006

Tip: Looking for answers? Try searching our database.

Please help with this code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
alvin Kuiper - 09 Nov 2006 14:59 GMT
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
alvin Kuiper - 09 Nov 2006 19:41 GMT
Have done it
Alvin

"alvin Kuiper" skrev:

> Hi
> I ahve this code:
[quoted text clipped - 51 lines]
> hope someone can help
> Alvin
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.