Mark B
2004-12-20 15:29:01 UTC
Hi all,
I need some help with the DoCmd.FindRecord function. I’m working with two
forms both of which have the table ‘data’ as it’s record source. What I’m
trying to do is click a command button on the first form and have the second
form load with the same record as the first form. What happens with out my
code is the second form loads with the data of the first record in the record
set. The field that I’m working with is ‘Institution’. The first form is
called ‘Form1’ and the second form is called ‘Budget’. The code is put into
the Form load event of the form ‘Budget’. I’ve been able to get the variable
to match the institution in the record in ‘Form1’. When the
Do.Cmd.FindRecord runs, I get the error number 2046: The command or action
“FindRecord” isn’t available now. – you may be in a read-only database or an
unconverted database from an earlier version of MS Access. – the type of
object the action applies to isn’t currently selected or isn’t in the active
view.
Also, I checked that the records lock property of both forms is set to No
Locks.
Here is my code:
Dim txtInstitutionName As TextBox
Set txtInstitutionName = Forms("Form1").txtInstitution
Institution.SetFocus
DoCmd.FindRecord "[Institution]= " & txtInstitutionName
Any help is greatly appreciated.
Mark
I need some help with the DoCmd.FindRecord function. I’m working with two
forms both of which have the table ‘data’ as it’s record source. What I’m
trying to do is click a command button on the first form and have the second
form load with the same record as the first form. What happens with out my
code is the second form loads with the data of the first record in the record
set. The field that I’m working with is ‘Institution’. The first form is
called ‘Form1’ and the second form is called ‘Budget’. The code is put into
the Form load event of the form ‘Budget’. I’ve been able to get the variable
to match the institution in the record in ‘Form1’. When the
Do.Cmd.FindRecord runs, I get the error number 2046: The command or action
“FindRecord” isn’t available now. – you may be in a read-only database or an
unconverted database from an earlier version of MS Access. – the type of
object the action applies to isn’t currently selected or isn’t in the active
view.
Also, I checked that the records lock property of both forms is set to No
Locks.
Here is my code:
Dim txtInstitutionName As TextBox
Set txtInstitutionName = Forms("Form1").txtInstitution
Institution.SetFocus
DoCmd.FindRecord "[Institution]= " & txtInstitutionName
Any help is greatly appreciated.
Mark