How add command button to a form in datasheet view

I have a form which has a query as its control source.  The form opens as a datasheet view.  Somehow I want to add a command button to the form (in datasheet view) that opens a second form when clicked.  Can this be done?
SteveL13Asked:
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.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Well, since the Header and Footer are not exposed in Datasheet view, the only place you can add a button is in the Detail section. So, each row would have the button.

mx
0
SteveL13Author Commented:
Actually, I tried that.  I added a command button in the detail section of the form and it doesn't display in the datasheet view.
0
SteveL13Author Commented:
And I also do want it to display on all the records if I could get it to show up.
0
The Ultimate Tool Kit for Technolgy Solution Provi

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 for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
OOPS ... that's right ... the button will not show in DS view. Your only option is to put the DS form on a main form ... and your button there.

mx
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
I suppose you could ... add a blank text box ... and use the Double Click event to open the other form.  

mx
0
Rey Obrero (Capricorn1)Commented:


would you consider using a continuous form for this?
0
SteveL13Author Commented:
So, here is another approach I'd like to use.  I need to stick with the datasheet view.  But with a double-click event on the 1st form I want the second form to open.  I have that working fine.  But both forms have a text box named "txtJobN".  When the second form opens after double clicking on the "gray box" to the far left of the record in the first form, I need txtJobN to autopopulate on the 2nd form with the txtJob from the first form.  How can I do this?
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Of course, a button *will* work on a continuous form.

mx
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Use this code in the button:

DoCmd.OpenForm "YourFormName", , , "[JobN]=" & Me.txtJobN

mx
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
If JobN is Text and not Numeric then:


DoCmd.OpenForm "YourFormName", , , "[JobN]=" & Chr(34) & Me.txtJobN & Chr(34)

mx

0
SteveL13Author Commented:
I tried both...
DoCmd.OpenForm "YourFormName", , , "[JobN]=" & Me.txtJobN
and
DoCmd.OpenForm "YourFormName", , , "[JobN]=" & Chr(34) & Me.txtJobN & Chr(34)
and neither worked.  JobN is a numeric field.
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Sorry:

    DoCmd.OpenForm "YourFormName"
    Forms("YourFormName").txtJobN = Me.txtJobN


mx
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
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Of course, replace the 'YourFormName' with the actual name of your form

mx
0
SteveL13Author Commented:
Worked!  Thank you.
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
Microsoft Access

From novice to tech pro — start learning today.