Results 1 to 5 of 5
  1. #1
    Mick99 is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Jul 2015
    Posts
    58

    FindNext - unknown function name

    Hi I have the following code and am trying to pass the value contained in STRScoloumdetail(1) to the FindNext criteria. It works fine if I hard code to value but when using the variable i just get the unknown function name. Any help would be greatly appreciated.

    Cheers MickClick image for larger version. 

Name:	Error.PNG 
Views:	13 
Size:	43.3 KB 
ID:	29265

    Private Sub Apply_Timing_Click()
    Dim RScoloumdetail As DAO.Recordset
    Dim FRScoloumdetail As DAO.Recordset
    Dim STRScoloumdetail As DAO.Recordset
    Dim CalDate As Variable
    Dim CountRecords As Integer
    Dim CountFormRecords As Integer
    Dim StartTime As Variant
    Dim REFKEYFIND As Variant
    Dim DurationAdd As Variant




    Set STRScoloumdetail = CurrentDb.OpenRecordset("Select * FROM [tbl start_Time]") ' Table that contains 1 entry only which is the start time
    REFKEYFIND = Forms![frm Agenda Maintenance].[REFKEY MASTER]
    Set RScoloumdetail = CurrentDb.OpenRecordset("Select * FROM [tbl MASTER DATA] WHERE [REFKEY MASTER] = '" & REFKEYFIND & "' ORDER BY MASTERSORT ASC") ' Needs to be changes to "Running_Order" whe time permits
    RScoloumdetail.MoveFirst
    StartTime = STRScoloumdetail(1) ' this contains the start time from the table start time
    Set FRScoloumdetail = CurrentDb.OpenRecordset("Select * From [24_Hour_Clock]")


    '''' I JUST NEED TO PASS THE VALUE FROM "STRScoloumdetail(1)" TO THE FINDNEXT SEARCH
    FRScoloumdetail.FindNext "[12Hour] = 8.30" 'this works fine but i need to use the STRScoloumdetail(1) value for the find criteria
    FRScoloumdetail.FindNext "[12Hour] = STRScoloumdetail(1)" ' i get unknown function name
    RScoloumdetail.Edit
    RScoloumdetail(5) = FRScoloumdetail(1)
    RScoloumdetail.Update
    ''''''''''''''''''''''''''''''
    'Fill remaing results
    Do
    DurationAdd = RScoloumdetail(4)
    FRScoloumdetail.Move [DurationAdd]
    RScoloumdetail.MoveNext
    RScoloumdetail.Edit
    RScoloumdetail(5) = FRScoloumdetail(1)
    RScoloumdetail.Update
    Loop


    End Sub

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    You have to concatenate the value into the string. Try:

    FRScoloumdetail.FindNext "[12Hour] = " & STRScoloumdetail(1)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Mick99 is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Jul 2015
    Posts
    58
    Legend, thank you so much that works a treat. Just wondering if there is a way that I can format the result as it is meant to display time. I have included a screen shot if that helps.

    Cheers MickClick image for larger version. 

Name:	format.PNG 
Views:	11 
Size:	8.2 KB 
ID:	29266

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Format the minutes? The Format() function should work:

    ?format(5/1440,"short time")
    00:05

    or whatever custom format gives you the look you want.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Mick99 is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Jul 2015
    Posts
    58
    Thanks, but i forgot to mention that i am using a short text field to hold this data and wondered if there was any code that could reformat the data to display like time.

    Cheers Mick

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

Similar Threads

  1. Unknown Error
    By Lou_Reed in forum Access
    Replies: 4
    Last Post: 09-21-2016, 02:10 PM
  2. dealing with an unknown number of events
    By merlin777 in forum Database Design
    Replies: 6
    Last Post: 09-24-2015, 10:12 AM
  3. Use "FindNext" Method in KML Text File
    By JonMulder in forum Programming
    Replies: 0
    Last Post: 02-08-2013, 12:59 PM
  4. rs.FindNext vs. rs.MoveNext
    By jgelpi16 in forum Programming
    Replies: 4
    Last Post: 02-04-2011, 03:13 PM
  5. Unknown Error
    By pimlicosnail in forum Forms
    Replies: 1
    Last Post: 02-26-2010, 10:19 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