1337Atreyu
1337Atreyu

Reputation: 223

DoCmd.OpenForm error

I have another visual basic for excel question. I want to open a second form and pass an argument to it. It seems the best way to do this is calling DoCmd.OpenForm, but when I do this (either with or without argument), I get the following error "Run-time error '424' Object required" When I debug, it points at this line:

DoCmd.OpenForm "frmCommitTracker"

The same also happens with the following code:

DoCmd.OpenForm "frmCommitTracker", , , , , , getCaseID()

Any clues? Is this allowable in Excel or is it just for Access? I'm so confused!

Thanks,

1337Atreyu

Upvotes: 0

Views: 1349

Answers (1)

Tim Williams
Tim Williams

Reputation: 166531

This should open a second form and return to the original one when the second form is closed.

Me.Hide
UserForm2.Show
Me.Show

If you want to pass a value to the second form then see here for a few options: http://dailydoseofexcel.com/archives/2004/07/22/passing-arguments-to-a-userform/

Upvotes: 1

Related Questions