MS ACCESS Can I change the button?



I used the form wizzard to build my form.  I have eddited to make some changes in placement etc to my liking.

I dont like the default buttons it usess to go though records and to add a new record.  Is there a way to change these buttons?

If so how?
LVL 1
mrchaos101Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Alan WarrenApplications DeveloperCommented:
Sure!
Create your own buttons for back and forward

' Command button called btnPrevious OnClick Event Procedure

Private Sub btnPrevious_Click()
  Dim gmsgText as String

On Error GoTo ReportError

  DoCmd.GoToRecord , , acPrevious

ExitProcedure:
  On Error Resume Next
  DoCmd.Hourglass False
  DoCmd.SetWarnings True
  Exit Sub

ReportError:
 
  Select Case Err.Number
    Case Is = 2105
      ' You can't go to the specified record.
      ' Do nothing
    Case Else
      gmsgText = "Error in " & Me.Name & ".btnPrevious_Click()" _
        & vbCr & "Error number " & CStr(Err.Number) _
        & " was generated by " & Err.Source _
        & vbCr & Err.Description
      MsgBox gmsgText, vbExclamation + vbMsgBoxHelpButton, "Error", Err.HelpFile, Err.HelpContext
  End Select
  Resume ExitProcedure


End Sub


' Command button called btnNext OnClick Event Procedure

Private Sub btnNext_Click()
  Dim gmsgText as String

On Error GoTo ReportError

  DoCmd.GoToRecord , , acNext

ExitProcedure:
  On Error Resume Next
  DoCmd.Hourglass False
  DoCmd.SetWarnings True
  Exit Sub

ReportError:
 
  Select Case Err.Number
    Case Is = 2105
      ' You can't go to the specified record.
      ' Do nothing
    Case Else
      gmsgText = "Error in " & Me.Name & ".btnNext_Click()" _
        & vbCr & "Error number " & CStr(Err.Number) _
        & " was generated by " & Err.Source _
        & vbCr & Err.Description
      MsgBox gmsgText, vbExclamation + vbMsgBoxHelpButton, "Error", Err.HelpFile, Err.HelpContext
  End Select
  Resume ExitProcedure

End Sub

You can do similar for last and  first and New

DoCmd.GoToRecord , , acLast
DoCmd.GoToRecord , , acFirst
DoCmd.GoToRecord , , acNewRec



Take care....


Alan

0
billmercerCommented:
If you want to change the appearance of a button, you can do that from the button's Format properties while in Design mode. Right click on the button and choose Properties. Look at the Format tab. You can change the text formatting, color, style, etc. You can also choose one of a number of built-in pictures for the button, or pick your own custom .BMP image.


0
mrchaos101Author Commented:
billmercer

that is kind of what im looking for... but when I use the BUILD FORM wizzard... it doesn't seem to put the button controlls on the form.

I has the labels and txt boxes etc...  I have changed the font size color etc... but no buttons

It doesn't seem to ADD the buttons to the form until you actualy run the from.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

billmercerCommented:
Ah, you're referring to the small set of buttons on the bottom of the screen. Those are actually a default set of buttons that can be added to any form. You can't really customize them directly. Instead you need to create your own buttons that do the same things, then arrange them and format them as you desire.

In design mode, click the Command Button icon in the toolbox, then click where you want the button to appear in your form. You'll be prompted to choose what the button will do. Choose Record Navigation, Go to First Record. Repeat the process, adding buttons that go to previous and next record, delete the current record, and so on. You can then customize and rearrange these buttons however you want.
Note that the default set of small buttons still shows up when you're entering data. To make it go away, go to the properties for the form and set "Record Selectors" to No. Now only your own buttons will appear.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
billmercerCommented:
By the way, AlanWarren's suggestion shows how you can use programming in Visual Basic for Applications (VBA) to customize how a button behaves.
If you've never used VBA before it may seem intimidating, but it is really not as hard as it looks, and if you plan to do a lot of work in Access, it's VERY worthwhile to learn. Lots of things that are very difficult or impossible to do with a wizard-generated form are easy with VBA.

0
mrchaos101Author Commented:
Ok That is about what I was looking for... one probelm


I put  my buttons on.... and wanted to move them to th HEADER section...it would not let me.  So I cut and pasted the buttons up there.

It didn't work.  I figured I could not do it that way.  So I deleted the buttons.

I put a new button back where I orginaly started but NOW it doesn't aske me what I want to do.  How do I turn that back on?
0
mrchaos101Author Commented:
doh ok I see the command wizzard button it needed to be yellow lol

Got it fixed.


OK the guy the VBA code was the answer.... I do know VB so it was easy to under stand...

The other guy with the  Wizzard was more along the lines of what I was looking for.

Im gonna do a split on the points on this one.

Thanks all.

ALSO as Im still eaching my self ACCESS I will have more therads please keep looking and helping

Thanks
0
mrchaos101Author Commented:
alan  

I had another fast question here...

in vb we used a name deal like  cmdSomething for a comand button and txtTextBox for text boxes...


I am seeing a lot of the same controlles and code here.... is it safe to asume I should be using the same way to name controlls?
0
billmercerCommented:
If someone besides yourself may have to work on it in the future, then you definitely should. Even if you're the only user, it's probably a good idea, it will make it easier to figure out what your code is doing six months later when you've forgotten what that module does... :)
.


0
streetskaterCommented:
MS Access has it's own subset* of VisualBasic which makes rapid prototyping pretty easy and very fast.  **I call it a subset because even though it has some unique features geared specifically for Access, it doesn't have everything that full blow VisualBasic has.  

Psstt.  Over here.
I sometime use Access with VisualBasic to do proof of concepts before gearing up with Oracle-Powerbuilder or SQL Server.....Let's just keep it between ourselves though.

As you get your footing customizing Access I would definitely spend some time building interfaces to your database with VisualBasic proper--and then maybe VisualC++.  You'll have A Lot more flexibility in your presentation layer.  It will also teach you fundamental about how to remotely access your database engine --as in through a intra or internet interface,

I know that doesn't directly answer your question but I gotta spend some time here building points so I can ask my own lame questions....:-)
0
simply_juniorCommented:
You can create command buttons in MS Access....try to visit help file plz,,,,
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.