Full Version: command button
UtterAccess Forums > Microsoft® Access > Access Forms
Does hurt anything to have a command buttons in different forms that have the same name??
orm1 = command button name is NextRec
form2 = command button name is NextRec
they both look for the next records designed by wizard?? but they both have the same name?? does that create a problem?
no it shouldn't hurt.
Are you having any problems with it?
no, i am just trying to read between the lines because
when i analyze my forms, it tells me to
use option explicit something
posted it before and people said someting about not having things declared, everything in my forms are created by wizards??
Odont know have the knoweldge to add my own things other than a couple of if statment, dlookup and strconv. and visible enable true and false statments!
i am not sure where that use option explicit statement came from and i thought maybe it was command buttons related??
I have noticed that this use option exlicit statment occurs as a recomendation
for the form that i have created my self,
form that have things like comboboxes to generate different reports and such??
so how do i fix that problem
Jack Cowley
I do not understand your question, but here is how to get Option Explicit to appear in all your code:
On the code editor select Tools > Options. On the Editor tab you should have 'Require Variable Declaration' checked. Now all your modules will have Option Explicit as part of the declarations when you create a new subroutine or module.
when i click on
and i select all ym forms
Oget alot of the
Use option explicity statment in form _________
And pretty much all my forms get listed with that recomendation?
i did the required variable decleation check
and it still does that
R. Hicks
The "Option Explict" statement is not in your modules ...
That is what Access is trying to tell you ...

For forms, reports and all other "existing" modules in your app .. you must manually place the line in each module.

It should look something like:

Option Compare Database
Option Explict

Then you need to follow Jack's advice to turn the feature "On" so it automatically places that line in any new module when it is created ...
This setting is "global" and will then be turned on for all new databases created on the specific machine.

sweet, you guys are great
it is nice to do something so simple and get read of so many headaches
Most of my command buttons do not WORK ANYMORE???
please help?
R. Hicks
Without knowing what you did .. we could only guess.
Try comipling your code and see what that uncovers ...
and how do you do that again?
the code for the comand buttons are there
and they are listed under the right action
but still not working?
i got it
Ofound outwhy it was not working
The code had a message box in it with the
for some reason it was spelled as
i know i did not do that myself, and i know that i have not changed it sense the last time it worked??
any reason as to why it would change by itself?? cause i am sure i did not do it for that i usually use the builder. ( the drop box that appaer when you are writing certain code to help you out)
R. Hicks
Open any module in design view ...
Choose Debug/Compile from the main menu in the VBA window ...
R. Hicks
The Option Explicit revealed the problem ..
That is what it is suppose to do ...
Thank you sir,
just for my knowledge and your opertunity to share your experience
That is option explicity, why use,. what does it do and how it efect the project if you were to not use ti?
Hi everyone and anyone!
I have a several forms each with a button called 'more' that opens the same form called 'moredetails'.
My various forms are called:
These forms reside on a Tab Form called Diary. As I said before, each form has a button called 'more'. This button opens up a 'moredetailsform' giving more details of the record. Using the TodayView form in this example of the underlying code:
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "moredetails"

stLinkCriteria = "[DiaryID]=" & Me![DiaryID]
DoCmd.OpenForm stDocName, , , stLinkCriteria.
However, I don't want to do the same thing with the other forms cos i am just repeating the code. So i created a function.
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "moredetails"

stLinkCriteria = "[DiaryID]=" & Forms!Diary![DiaryID]
DoCmd.OpenForm stDocName, , , stLinkCriteria.
with Diary being the Main Form, and called it to the onClick event of each button on each subform (the ones above). The code runs with no errors but instead of bringing up the corresponding DiaryID of the form its in, it just brings up the last DiaryID entered in the recordset. eg, i could click the more button on record 1712 and it will bring up the more details form for the last record entered being 2856.
What sort of statement would i need to tell access that this procedure has to be called from a different form at any one time in order to bring up the corresponding more details form that its currently in! So thats one piece of code but to identify the existing form its in when its called at runtime as determined by the form the user is in when they click the more button
Am I talking spaghetti?
R. Hicks
You really need to learn how to use the help files in Access ...
From Access VBA Help Files:
Man, i am getting alittle frustrated with your comment that i should use the help files???
but you never told me how to use them??
I have mentioned before on several occassions that either my help files do not work or i dont know how to use them
Lok at the following examples
I type in I get this?
dlookup Troubleshoot Expressions
message box get discription but not how to make one?
normalization tools analyze and table
Control source set the default printer property???
Option Explicit Help about SQL query????
and those only a few of the very RETARDED answers i get from access help files!
now if you think i am asking help files the wrong questions then stop telling me to use the help files for those questions,
and if you think i am using it wrong, then stop telling me to use the help files and tell me how to use them,
because if my questions bother you so bad that you have to say that to me several times. Then just dont read my posts. Okay
Sorry if i am sounding rude , but i am trying to learn a software that you have dedicated many years of your life to understand and i am sorry if i am not the access god like you.
the above post was not clear as to what i type in and teh search resutlt so here it is again
type in(((()))) I get this?
dlookup (((()))) Troubleshoot Expressions
message box (((()))) get discription but not how to make one?
normalization (((()))) tools analyze and table
Control source(((()))) set the default printer property???
Option Explicit (((()))) Help about SQL query????
Open the visual basic environment by hitting Alt-F11. Use that help system, it's about a thousand times better on returning something related to what you type in.
lso, from both inside and outside of the Visual basic environment, Access has context-sensitive help. Click on or highlight something and press F1 and you will get help on that object/property/keyword/etc.
R. Hicks
Do you even know there are 2 help files in Access 2000 and higher ???

One is for VBA related help and can only be accessed from within the VBA environment .. such as within a module ..

"Option Explict" .. is a VBA related subject (as it is in a VBA Module) and would be found in the "VBA Help Files .. and I specified "VBA Help files" .. go back to the reply and look ...

Now .. for this attitude you seemed to have developed ...
Oposted that you needed to learn to use the Access Help files .. and the statement stands.
The answers to many of the questions you have asked can be found there ...
Throwing your hands up and saying .. "I just can't use them" .. will not overcome this problem .. as you will continue to be dependant on others for solutions to things you should be able to solve yourself ...

Now .. for this attitude you seemed to have developed ...
Odont believe i am, but just in case i am
I am sorry
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.