View Full Version : DoCmd.GoToRecord


casey
06-11-2001, 10:11 AM
Hello,

I'm trying to use the DoCmd.GoToRecord command on a subform to go to a new record. (DoCmd.GoToRecord acDataForm, "OrderPartsSub", acNew)
An error message appears saying that the subform isn't open.
Any ideas what I'm doing wrong here?

DRananahan
06-11-2001, 10:31 AM
I am pretty sure that you will need to declare the name of the host form then the subform i.e. "frmMainForm.frmSubForm".

Rich
06-11-2001, 10:36 AM
DoCmd.Go To Control subformName
DoCmd.Go To Record etc, you might find it easier to create a macro to do this initially and then convert it to vba.
HTH

casey
06-11-2001, 10:37 AM
Thanks for the reply, DRananahan. But it still says that the subform is not open.
Any other ideas?

[This message has been edited by casey (edited 06-11-2001).]

BillNorton
06-11-2001, 10:53 AM
Shacket was asking the same thing over here: http://www.access-programmers.co.uk/ubb/Forum4/HTML/003162.html

Unfortunately he (she) is still having trouble with it.

Bill Norton
Austin, TX

KevinM
06-12-2001, 01:15 AM
Forms!MainForm!Subform.SetFocus
DoCmd.GoToRecord , , acNewRec

HTH

casey
06-12-2001, 07:15 AM
Thanks to everyone. What finally worked was to set the subform's DataEntry property to true before I updated it. This seems to do what I need.
I have a feeling that what you all suggest(GotoRecord, , acNew) should have worked and is what I really need to do, but for some reason, it doesn't seem to work in Access 2000.
Thanks again.