DoCmd.FindRecord method

R

Rod Behr

The final line of this code returns an unexpected error:

DoCmd.OpenForm "CodecGotoHidden", acNormal, "", "", , acHidden
Forms!CodecGotoHidden!Codec = Forms![codecselect subform]!CodecID
DoCmd.OpenForm "CodecMain", acNormal, "", "", , acNormal
DoCmd.GoToControl CodecID
DoCmd.FindRecord Forms!CodecGotoHidden!Codec

When I search for the value of Forms!CodecGotoHidden!Codec in the CodecID
field of the CodecMain form, an error box tells me "There is no field named
'6' in the current record" (6 is the value of Forms!CodecGotoHidden!Codec).

I am not searching for a field! I am searching for a record whose CodecID
(the Primary Key for that dataset) matches Forms!CodecGotoHiddel!Codec.
Access Help tells me that the FindRecord method should mimic the function of
"Edit", "Find" from the drop-down menu, but it clearly isn't doing so. What
am I doing wrong?
 
R

Rod Behr

CodecID is an unbound text box on a form and can have any numeric value
equal to the Primary Key Autonumber of the record in the table behind form
CodecMain.

david epsom dot com dot au said:
DoCmd.GoToControl CodecID

What is the value of CodecID?

(david)

Rod Behr said:
The final line of this code returns an unexpected error:

DoCmd.OpenForm "CodecGotoHidden", acNormal, "", "", , acHidden
Forms!CodecGotoHidden!Codec = Forms![codecselect subform]!CodecID
DoCmd.OpenForm "CodecMain", acNormal, "", "", , acNormal
DoCmd.GoToControl CodecID
DoCmd.FindRecord Forms!CodecGotoHidden!Codec

When I search for the value of Forms!CodecGotoHidden!Codec in the CodecID
field of the CodecMain form, an error box tells me "There is no field
named
'6' in the current record" (6 is the value of
Forms!CodecGotoHidden!Codec).

I am not searching for a field! I am searching for a record whose CodecID
(the Primary Key for that dataset) matches Forms!CodecGotoHiddel!Codec.
Access Help tells me that the FindRecord method should mimic the function
of
"Edit", "Find" from the drop-down menu, but it clearly isn't doing so.
What
am I doing wrong?
 
D

david epsom dot com dot au

CodecID is an unbound text box on a form and can have any numeric value

So, if the value of CodecID is 6, the command
DoCmd.GoToControl 6
will generate the error message

"There is no field named '6' in the current record"

(david)

Rod Behr said:
CodecID is an unbound text box on a form and can have any numeric value
equal to the Primary Key Autonumber of the record in the table behind form
CodecMain.

david epsom dot com dot au said:
DoCmd.GoToControl CodecID

What is the value of CodecID?

(david)

Rod Behr said:
The final line of this code returns an unexpected error:

DoCmd.OpenForm "CodecGotoHidden", acNormal, "", "", , acHidden
Forms!CodecGotoHidden!Codec = Forms![codecselect subform]!CodecID
DoCmd.OpenForm "CodecMain", acNormal, "", "", , acNormal
DoCmd.GoToControl CodecID
DoCmd.FindRecord Forms!CodecGotoHidden!Codec

When I search for the value of Forms!CodecGotoHidden!Codec in the
CodecID
field of the CodecMain form, an error box tells me "There is no field
named
'6' in the current record" (6 is the value of
Forms!CodecGotoHidden!Codec).

I am not searching for a field! I am searching for a record whose
CodecID
(the Primary Key for that dataset) matches Forms!CodecGotoHiddel!Codec.
Access Help tells me that the FindRecord method should mimic the
function
of
"Edit", "Find" from the drop-down menu, but it clearly isn't doing so.
What
am I doing wrong?
 
R

Rod Behr

That's the one.

david epsom dot com dot au said:
CodecID is an unbound text box on a form and can have any numeric value

So, if the value of CodecID is 6, the command
DoCmd.GoToControl 6
will generate the error message

"There is no field named '6' in the current record"

(david)

Rod Behr said:
CodecID is an unbound text box on a form and can have any numeric value
equal to the Primary Key Autonumber of the record in the table behind form
CodecMain.

david epsom dot com dot au said:
DoCmd.GoToControl CodecID

What is the value of CodecID?

(david)

The final line of this code returns an unexpected error:

DoCmd.OpenForm "CodecGotoHidden", acNormal, "", "", , acHidden
Forms!CodecGotoHidden!Codec = Forms![codecselect subform]!CodecID
DoCmd.OpenForm "CodecMain", acNormal, "", "", , acNormal
DoCmd.GoToControl CodecID
DoCmd.FindRecord Forms!CodecGotoHidden!Codec

When I search for the value of Forms!CodecGotoHidden!Codec in the
CodecID
field of the CodecMain form, an error box tells me "There is no field
named
'6' in the current record" (6 is the value of
Forms!CodecGotoHidden!Codec).

I am not searching for a field! I am searching for a record whose
CodecID
(the Primary Key for that dataset) matches Forms!CodecGotoHiddel!Codec.
Access Help tells me that the FindRecord method should mimic the
function
of
"Edit", "Find" from the drop-down menu, but it clearly isn't doing so.
What
am I doing wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top