Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820

    Unanswered: Why Wont this code work

    systems.FindFirst ("SystemID = " & (100 * i + j))' = error 3251

    in the code

    Private Sub Gengal_Click()
    DoCmd.RunSQL "DELETE Systems.* FROM Systems;"

    Dim SysTypes As DAO.Recordset, systems As DAO.Recordset, temp As Integer
    Set SysTypes = CurrentDb.OpenRecordset("SysType", dbOpenSnapshot, dbReadOnly, dbReadOnly)
    Set systems = CurrentDb.OpenRecordset("SysTems")
    Randomize
    For j = 0 To Val(SizeY)
    For i = 0 To Val(SizeX)
    temp = Int(Rnd * 20)
    SysTypes.FindFirst ("typeID = " & temp)
    If Not (SysTypes.NoMatch) Then
    systems.AddNew
    systems!SystemType = temp
    systems!SystemID = 100 * i + j
    systems.Update
    End If
    Next
    Next
    GalaxyDisplay = " "
    For i = 0 To Val(SizeX)
    GalaxyDisplay = GalaxyDisplay & Right$(" " & i, 3)
    Next

    For j = 0 To Val(SizeY)
    GalaxyDisplay = GalaxyDisplay & vbCrLf & Right$(" " & j, 3)
    For i = 0 To Val(SizeX)
    systems.FindFirst ("SystemID = " & (100 * i + j)) '<----------------
    If systems.NoMatch Then
    GalaxyDisplay = GalaxyDisplay & " "
    Else
    GalaxyDisplay = GalaxyDisplay & " " & systems("SystemType").Value & " "
    End If
    Next
    Next
    End Sub
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  2. #2
    Join Date
    Nov 2002
    Posts
    150

    Re: Why Wont this code work

    What's the error?

  3. #3
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820

    Re: Why Wont this code work

    Originally posted by m.timoney
    systems.FindFirst ("SystemID = " & (100 * i + j))' = error 3251
    don't matter now seems you cant find things in a table type recordset, had to shift the damn thing to a Dynamic type
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •