Tool Box Command button doesn't work

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I used the tool box to inset a command button into Form A. The command button
opens another form, Form B. This works fine. I then dragged Form A into a
third form, Form C. Form A works fine from within Form C, except the command
button in Form A does not work under these conditions. Any help on this would
be appreciated.
 
Hi,


What syntax is used behind your button click event handler to open the form
FormB?


Hoping it may help,
Vanderghast, Access MVP
 
Thanks for responding to my question Michel.

I didn't actually write the code, I just let the create button wizard lead
me through the process. If you were to create a button using the wizard and
tell it you wanted to open a form that would give you what ever code I got. I
don;'t really know how to code, but you might be able to give me some
pointers to modify the wizards code. My best guess would be that the
variables and procedure are private and by importing that form into another
form I need to make the variables and procedure global or public, but I don't
really know.

Thanks Jim
 
Hi,


Is it possible that the form DID open, but behind the actual form, so you
don't see it? try moving the actual form a little to see if it is not
hiding anything under it.



I created a FormA with just a label in it ("FormA"). I saved it.

I create a FormB with just a command button in its detail section , and use
the Wizard to make it opens FormA. Works. Saved.

I create a FormC with just a subform/subreport on it, and use the Wizard to
make it FormB used as subform. Saved. Opening FormC, clicking on the button
of FormB, FormA did open correctly. Your experimentation differs here? If
not, what is different than for your real case?



Hoping it may help,
Vanderghast, Access MVP
 
I guess I have to give you the long version. I have a table of items that I
want to be able to thumb through alphabetically. So, I created 26 queries.
For instance Query M returns a list of items with names that begin with M.
Form M uses Query M to display a continuous list of items with a name that
begins with M. When I open Form M, I can scroll up and down the list of items
and if I click on any item name, it brings up a Form which displays that
items record.

Now I created another form with 26 tabs at the top (from A to Z). When I
click on any tab ( say M), that page displays the associated Form M which
uses the associated Query M and displays the list of items. However, under
these conditions the scroll bar in Form M doesn't scroll (I have to right
click on the scroll bar and click on "scroll here" to make the scroll bar
move), but as well, when I click on the name of the item in the displayed
list, the associated record does not open as it did when I was using using
Form M by it self.
 
Hi,


I was not aware some Wizard would produce that kind of code, namely, to
open a form when we click on a text control (or is it a list box control? ).
Can you get the VBA code that is executed and post it here?



Vanderghast, Access MVP
 
Actually, I put a toolbox generated button over the item name and make the
button invisible. Here is the code

Private Sub Command6_Click()
On Error GoTo Err_Command6_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Movie Record"

stLinkCriteria = "[ID]=" & Me![ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command6_Click:
Exit Sub

Err_Command6_Click:
MsgBox Err.Description
Resume Exit_Command6_Click

End Sub


I wouldn't mind sending you the entire data base file if you wanted to look
at it.
 
Hi,


Great. There should be no problem, but I would try:


Private Sub Command6_Click()
On Error GoTo Err_Command6_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Movie Record"

if IsNull( Me![ID] ) then ' <<< here
DoCmd.OpenForm stDocName '<<< here

else '<<< here
stLinkCriteria = "[ID]=" & Me![ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

end if ' <<< here



Exit_Command6_Click:
Exit Sub

Err_Command6_Click:
MsgBox Err.Description
Resume Exit_Command6_Click

End Sub



and be sure the button is just TRANSPARENT (not invisible, not not-enabled)
and that its z-order is "on top" of the text control).



Hoping it may help,
Vanderghast, Access MVP



Jim said:
Actually, I put a toolbox generated button over the item name and make the
button invisible. Here is the code

Private Sub Command6_Click()
On Error GoTo Err_Command6_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Movie Record"

stLinkCriteria = "[ID]=" & Me![ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command6_Click:
Exit Sub

Err_Command6_Click:
MsgBox Err.Description
Resume Exit_Command6_Click

End Sub


I wouldn't mind sending you the entire data base file if you wanted to
look
at it.


Michel Walsh said:
Hi,


I was not aware some Wizard would produce that kind of code, namely,
to
open a form when we click on a text control (or is it a list box
control? ).
Can you get the VBA code that is executed and post it here?



Vanderghast, Access MVP
 
Back
Top