Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datamember Not Found

Status
Not open for further replies.

tfhwargt3

Programmer
Sep 19, 2006
61
US
I am trying to make a simple form with a close button separate from the x in the top right corner.

I have made the button in the middle of the form. The button is called Command1. In the code section of the button I have:

Code:
Private Sub Command1_Click()
    Me.Close()
End Sub

When the form loads it displays the button alright and when I click it it says:

"Compile Error: Syntax Error"

And that's it? One lead to why this error is occurring might be that when I type "Me." and wait for the small helper window to come up, the method Close is not in the options.

I have also tried substituting the name of the form in for Me and it yields the same error.

Thanks for any help.
 
Also, if I do not run the program and move to another line, the line with Me.Close() turns red, and says it expects and = on that line.
 
tfhwargt3 said:
the method Close is not in the options
That would be because there is no Close method in VB forms. Perhaps you were thinking of Access? If you were, then you should be warned that the visual aspects of VB (controls, forms, etc.) often behave different than their counterparts in VBA.

As keenanbr mentioned, Unload is the standard command to unload a form.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top