Results 1 to 3 of 3
  1. #1
    arnaldo is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Posts
    2

    Missing methor or datamember

    I converted a database from access 97 to access 2007. It is not easy!
    I solved a lot of problems but not this (error in red):

    Option Compare Database
    Option Explicit
    Sub Familjeetiketter()
    ' Slår ihop alla med samma telefonnummer
    Dim MyDB As Database
    Dim MyRs As Recordset
    Dim YourDB As Database
    Dim YourRs As Recordset
    Dim I As Integer
    Dim J As Integer
    Dim Enamn(6) As String
    Dim Fnamn(6) As String
    Dim Spar As Variant
    Dim Jmf As Variant
    Dim Sqlstr As String
    Dim D As String
    Dim A As Boolean
    Dim Sparadress As String
    Dim SparPA As String
    ' Nollställ arbetstabellen
    Sqlstr = "DELETE Etiketter_work.MeraNamn FROM Etiketter_work WHERE (((Etiketter_work.MeraNamn) Is Not Null));"
    DoCmd.SetWarnings False
    DoCmd.RunSQL Sqlstr
    ' Lägg dit de som INTE har telefon
    Sqlstr = "INSERT INTO Etiketter_work ( Adress, MeraNamn, PA ) "
    Sqlstr = Sqlstr & "SELECT huvudtabell.Adress, [Förnamn] & ' ' & [Efternamn] AS N, [Postnummer] & ' ' & [Ort] AS A "
    Sqlstr = Sqlstr & "FROM huvudtabell WHERE (((huvudtabell.Telefon) Is Null))ORDER BY huvudtabell.Telefon;"
    DoCmd.RunSQL Sqlstr
    DoCmd.SetWarnings True

    For I = 1 To 5 ' Initiera den tabell som används för att slå ihop familjer
    Enamn(I) = ""
    Fnamn(I) = ""
    Next I

    Set MyDB = DBEngine.Workspaces(0).Databases(0)
    Set MyRs = MyDB.OpenRecordset("Etikett_sammanslagning1", DB_OPEN_DYNASET)
    Set YourDB = DBEngine.Workspaces(0).Databases(0)
    Set YourRs = MyDB.OpenRecordset("Etiketter_Work", DB_OPEN_DYNASET)

    While Not MyRs.EOF
    Spar = MyRs.Telefon
    Sparadress = MyRs.Adress
    SparPA = MyRs.Postnummer & " " & MyRs.Ort
    Jmf = MyRs.Telefon
    I = 0
    'Do Until MyRs.EOF Or Spar <> Jmf
    While Spar = Jmf 'And MyRs.EOF
    If IsNull(Jmf) Then
    YourRs.AddNew
    YourRs.Adress = MyRs.Adress
    YourRs.PA = MyRs.Postnummer & " " & MyRs.Ort
    YourRs.MeraNamn = MyRs.Förnamn & " " & MyRs.Efternamn
    YourRs.Update
    Else
    If I = 0 Then
    I = I + 1
    Enamn(I) = MyRs.Efternamn
    Fnamn(I) = MyRs.Förnamn
    Else


    A = False
    For J = 1 To I
    If MyRs.Efternamn = Enamn(J) Then
    Fnamn(J) = Fnamn(J) & " o " & MyRs.Förnamn
    A = True
    End If
    Next J
    If Not A Then
    I = I + 1
    Fnamn(I) = MyRs.Förnamn
    Enamn(I) = MyRs.Efternamn
    End If
    End If
    End If
    MyRs.MoveNext
    If MyRs.EOF Then
    Jmf = "dfg-SLUT-gdfg"
    Else
    Jmf = MyRs.Telefon
    'Sparadress = MyRs.Adress
    'SparPA = MyRs.Postnummer & " " & MyRs.Ort
    End If
    Wend
    If I > 0 Then
    YourRs.AddNew
    D = ""
    For J = 1 To I
    If J > 1 Then D = D & " o "
    D = D & Fnamn(J) & " " & Enamn(J)
    Next J
    YourRs.MeraNamn = D
    YourRs.PA = SparPA
    YourRs.Adress = Sparadress
    YourRs.Update
    End If
    For I = 1 To 5 ' Initiera den tabell som används för att slå ihop familjer
    Enamn(I) = ""
    Fnamn(I) = ""
    Next I
    Spar = Jmf
    I = 0
    Wend
    MyRs.Close
    YourRs.Close
    End Sub

    I had to change in Virtual Basic the reference from the old DAO.2535 to DAO.360. May be this is the error.

  2. #2
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481

    I believe that when you are referring to field names

    you must use an exclamation mark, e.g.
    Spar = MyRs!Telefon
    I thought this requirement existed for earlier versions of Access as well, so I'm not at all sure this will solve your problem.
    It appears that a number of other references must be changed as well.

  3. #3
    arnaldo is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Posts
    2
    It works!
    Thank you!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. missing wizard
    By phineas629 in forum Access
    Replies: 2
    Last Post: 10-18-2011, 02:34 PM
  2. Missing Reference
    By teebumble in forum Access
    Replies: 17
    Last Post: 10-05-2011, 01:35 PM
  3. What is missing in it?
    By cap.zadi in forum Forms
    Replies: 7
    Last Post: 10-05-2011, 12:47 AM
  4. ok what am i missing here ?
    By baseborn in forum Forms
    Replies: 6
    Last Post: 12-21-2010, 01:46 PM
  5. Probably missing something easy
    By z1efuller1 in forum Database Design
    Replies: 5
    Last Post: 11-12-2009, 11:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums