Simple, but needed

  • Thread starter Thread starter Ben
  • Start date Start date
B

Ben

Hi, i dont really have any experience with Access,
but need to do something

anyone got the simple code to open up a form from a command button?
lets say the form name is barcode

what would i put to open this form from the command button...
open.barcode? I know its not this simple, but some help would be
appreciated.. thanks
Ben
 
Ben said:
Hi, i dont really have any experience with Access,
but need to do something

anyone got the simple code to open up a form from a command button?
lets say the form name is barcode

what would i put to open this form from the command button...
open.barcode? I know its not this simple, but some help would be
appreciated.. thanks
Ben

The command button wizard will happily build this button for you. But
if you want to do it yourself, the essential line of code is

DoCmd.OpenForm "barcode"

The code generated by the wizard is a bit more elaborate, but that's
what it boils down to.
 
I thought the wizard would have done it for me, but the only options are the
navigating options.. which is why im doing it myself...

Is this using vbscript, and if so, where do i put it?
 
Ben said:
I thought the wizard would have done it for me, but the only options are the
navigating options.. which is why im doing it myself...

Is this using vbscript, and if so, where do i put it?

Drop a new button on the form with the wizard enabled.

Categories = "Form Operations"
Action = "Open Form"

[Next]

Select the name of the desired form from the list.
 
Ben said:
I thought the wizard would have done it for me, but the only options
are the navigating options.. which is why im doing it myself...

If you click on "Form Operations" in the Categories list, among the
actions available in the Actions list is "Open Form".
Is this using vbscript, and if so, where do i put it?

Not VBScript, but VBA (Visual Basic for Applications), the programming
language that underlies all the programs in the Office suite.

Suppose you added the button without the wizard. With the button
selected (on the form in design view), click the little "magic wand" on
the toolbar; the "Build" button. That will create the shell of an
event procedure for the button's Click event, and will display it for
you in the VB Editor. It will look something like this:

Private Sub Command1_Click()

End Sub

All you have to do (at a minimum, and without concerning yourself with
error-handling code) is insert the line I suggested between the "Sub"
and "End Sub" lines, like this:

Private Sub Command1_Click()

DoCmd.OpenForm "barcode"

End Sub

Close the VB Editor, save the form, and bob's your uncle.
 
Found out why this aint working.... because im in the wrong group... :(
Im trying to make the command box in the data access page, which uses
VBScript....

I have basic VB editor skills, but not VBScript
 
Ben said:
Found out why this aint working.... because im in the wrong group...
:( Im trying to make the command box in the data access page, which
uses VBScript....

I have basic VB editor skills, but not VBScript

I'm sorry, I don't know anything about Data Access Pages. I suggest you
try the newsgroup <microsoft.public.access.dataaccess.pages>.

It occurs to me that you may need to use a hyperlink instead of a
command button, but that's just speculation on my part.
 
Ben, why don't you use the wizard on the tool box to create a command button
to open the form?
 
Back
Top