Results 1 to 11 of 11
  1. #1
    pixadecavalo is offline Novice
    Windows 11 Access 2021
    Join Date
    Jun 2023
    Posts
    5

    Question Can't use FindRecord Macro

    Hi everyone,



    Trying to use a simple macro but can seem to make it work.

    Macro: SearchForRecord
    Where condition: [ID]=[Forms]![Form1]![TextBox1]

    Try's to search but never returns the ID value of TextBox1

    Probably would work with VBA but already have a lot of macros working together.

    Any suggestions?

    Thank you!

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    Looks like you are missing a couple of !

  3. #3
    pixadecavalo is offline Novice
    Windows 11 Access 2021
    Join Date
    Jun 2023
    Posts
    5
    Sorry, I have then on my macro, forgot to put them here

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    I don't use macro's so can only suggest the usual:

    is the event where you have this code firing?
    is form1 open and spelt correctly?
    is TextBox1 spelt correctly?
    does the field ID exist in the recordsource?
    does the value entered in textbox1 actually exist in your ID data?

    Recommend you give objects meaningful names. Looks like you are using the default names on creation - except textbox1.

  5. #5
    pixadecavalo is offline Novice
    Windows 11 Access 2021
    Join Date
    Jun 2023
    Posts
    5
    is the event where you have this code firing? Yes, its onClick of a button
    is form1 open and spelt correctly? Yes
    is TextBox1 spelt correctly? Yes
    does the field ID exist in the recordsource? Yes
    does the value entered in textbox1 actually exist in your ID data? If I change to [ID]=11 it works, if I use [ID]=[Forms]![Form1]![TextBox1] and insert 11 on the Text box, it doesn't work.
    Even changed the text box data type to numeric on both to try and solve it

  6. #6
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    well, as I said, I don't use macros so unable to help further. Suggest you try VBA, it has much better functionality for debugging

  7. #7
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    My Search For A record looks nothing like that?
    Attached Thumbnails Attached Thumbnails search macro.PNG  
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  8. #8
    pixadecavalo is offline Novice
    Windows 11 Access 2021
    Join Date
    Jun 2023
    Posts
    5
    Itīs the same, my question is on the "where condition" field

  9. #9
    davegri's Avatar
    davegri is online now Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    This works for me. Looks odd but be sure first 2 equals are present.

    Click image for larger version. 

Name:	McCrit.png 
Views:	18 
Size:	14.6 KB 
ID:	50437
    Last edited by davegri; 06-30-2023 at 08:43 AM. Reason: added image

  10. #10
    pixadecavalo is offline Novice
    Windows 11 Access 2021
    Join Date
    Jun 2023
    Posts
    5
    @davegri, absolute legend, thank you very much!

  11. #11
    davegri's Avatar
    davegri is online now Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    Quote Originally Posted by pixadecavalo View Post
    @davegri, absolute legend, thank you very much!
    Glad to help and thanks for the star!!

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

Similar Threads

  1. OpenArgs and FindRecord combination
    By Stretholox in forum Access
    Replies: 7
    Last Post: 12-10-2014, 10:35 AM
  2. Replies: 6
    Last Post: 08-09-2014, 01:09 PM
  3. FindRecord Problem
    By zareh in forum Programming
    Replies: 10
    Last Post: 02-27-2014, 12:22 PM
  4. can not use FindRecord with string
    By john60 in forum Programming
    Replies: 2
    Last Post: 08-10-2013, 08:25 AM
  5. Can you use a parameter in findrecord?
    By P5C768 in forum Programming
    Replies: 2
    Last Post: 08-20-2009, 04:36 AM

Tags for this Thread

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