Search code examples
ms-accessms-access-2016

Find recorset with variable name


I've defined a global variable : chosen_operator then, i need to search a form and find recordset with this variable in the field [op_choice]

trying :

Dim rstformat As Recordset

With Forms("form_list_of_columns").rstformat  
.FindFirst CHOSEN_OPERATOR
End With

does not work

i also tried with

DoCmd.FindRecord CHOSEN_OPERATOR,, True,, True

always tell me object not defined or ... does not match method ....

any idea ?


Solution

  • Try

    With Forms("form_list_of_columns").Recordset  
    .FindFirst "[op_choice]='" & CHOSEN_OPERATOR & "'"
    End With
    

    If [op_choice] is numeric, remove single quotes