D
DoveArrow
I have a form with two combo boxes, that I'm using to search for
records in a particular table that is tied to a second form. In order
to find the appropriate record, I need to search in two different
fields: Program, and Catalog Year. The following is the code that I've
been using to accomplish just that.
str = Me.Program
DoCmd.OpenForm "frmProgramRequirements"
Forms!frmProgramRequirements!Program.SetFocus
DoCmd.FindRecord str
Do Until Forms!frmProgramRequirements!CatalogYear = Me.CatalogYear
DoCmd.FindNext
Loop
DoCmd.Close acForm, "fselProgramCatalogYear"
Now this works fine the first four or five times. However, on the
fifth or sixth try, the program goes haywire, looping infinitely until
it runs out of memory. Then, every time after that, I get any of three
error messages:
Run-time error '3709': The search key was not found in any record.
(Happens when the second form isn't already open.)
Run-time error '3021': No current record. (Happens when I simply try
to run the sequence again without changing the program or catalog year
and the second form is open.)
Run-time error '2465': Microsoft Office Access can't find the field
'|' referred to in your expression. (Happens when I change the program
and catalog year and the second form is open.)
I am utterly perplexed as to why this is happening, so any insight
that someone might be able to provide would be appreciated. Thanks.
records in a particular table that is tied to a second form. In order
to find the appropriate record, I need to search in two different
fields: Program, and Catalog Year. The following is the code that I've
been using to accomplish just that.
str = Me.Program
DoCmd.OpenForm "frmProgramRequirements"
Forms!frmProgramRequirements!Program.SetFocus
DoCmd.FindRecord str
Do Until Forms!frmProgramRequirements!CatalogYear = Me.CatalogYear
DoCmd.FindNext
Loop
DoCmd.Close acForm, "fselProgramCatalogYear"
Now this works fine the first four or five times. However, on the
fifth or sixth try, the program goes haywire, looping infinitely until
it runs out of memory. Then, every time after that, I get any of three
error messages:
Run-time error '3709': The search key was not found in any record.
(Happens when the second form isn't already open.)
Run-time error '3021': No current record. (Happens when I simply try
to run the sequence again without changing the program or catalog year
and the second form is open.)
Run-time error '2465': Microsoft Office Access can't find the field
'|' referred to in your expression. (Happens when I change the program
and catalog year and the second form is open.)
I am utterly perplexed as to why this is happening, so any insight
that someone might be able to provide would be appreciated. Thanks.