Gotorecord on Close_Form I don't know what I am doing wrong...

G

Guest

I have a Form and pops up over another form when you select a button to do
some mathematical calculations. When the calculations are complete, I want
to make sure that I am coming back to my main form at the correct record.

I have a global variable TempRecordID which I load with the record number
of my main table. However I get an error when I run this command during the
close form of my math calc form:

DoCmd.GoToRecord acDataForm, "Base_Main_Form", acGoTo, TempRecordID

Base_Main_Form is my main form.

The error message I get is the "Can't go to the specified record" . I have
used this code in another function that is virtually identical to this and
and it works fine.

TempRecordID does have the correct record number.

So am I doing something wrong and it's a fluke that it is running fine
elsewhere?
 
S

Steve Schapel

Kmh,

I can't see anything wrong with the code. Perhaps you could set the
focus to the Base_Main_Form form first. But also I am wondering at the
necessity for this in the first place. If the Base_Main_Form form is
open at a particular record, and then another form opens and closes, I
would expect the current record on the Base_Main_Form form to always be
the same as it was originally, unless something explicitly changes that
in the meantime.
 
G

Guest

Thanks for your help. You're right I didn't need it, and I have it all
working.

Thanks again for your help,
Kathy
 

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