Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 249
  • Last Modified:

button in table on form

hey guys,

i have a form and on it it has a table. this table contains all the steps in a workflow a staff has to do to finish a certain activity. i would like to have a command button in each row of the table so that when the staff clicks it, it will run code to complete that task.

how can i do so? or if this is not possible is there a work around? or if not possible still is there a different way? thanks guy!! = ))
0
developingprogrammer
Asked:
developingprogrammer
2 Solutions
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
When you say a "table", what exactly do you mean? You can't embed a table in a form, although you can build a datasheet form that looks somewhat like a table.

If you have a datasheet form, then you can't add buttons to that form. You'd have to change to a continuous form, and build that to look like a datasheet (and you can then also add your button). You might also be able to use a hyperlink field to do this, but that is troublesome (at best). You're much better off switching over to a continuous form and formatting it to look like you need.

Also - are these predefined tasks? That is, you have a set of 5 (or 10, or 100) tasks, and you have predefined actions which must be taken to complete that task? If you don't, then I'm not sure how you'd write code in advance that would complete the task.
0
 
BitsqueezerCommented:
Hi,

in one point I disagree with LSM Consulting: You can of course implement a table or a view directly into a form without creating a datasheet form, but I don't recommend to do so. That can be done by simply creating a subform and set the SourceObject property to the name of the table, that's all.

This is not recommended because you have no control over the table/view because there are no events like in a form. You can also not enable/disable a field or use Conditional Formatting and so on. So this method is only usable if you really only want to display some data without interaction by the user or if you want to display different views in one form (also only for displaying).

So the solution is to use a continous form either in datasheet view or normal continous form view. In the last case you have all formatting possibilities like adding a button and so on, in datasheet view you can only use a "fake" hyperlink: Simply display the text of a field underlined and in blue color so it looks like a hyperlink and then use the click event of the field to do something with the current line. This works in continous forms and datasheet view, but depending on the Access version you will not see the underlining and blue color in datasheet view.
Adding a button in a normal continous form view is no problem and you need not much code to make that work.

See the attachment demo database where I show all these methods.

Cheers,

Christian
ButtonTable.zip
0
 
developingprogrammerAuthor Commented:
guys superb answers and thanks so much for the help!! let me implement this and then reply yall ok? thanks so much once again guys!! = ))
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Tackle projects and never again get stuck behind a technical roadblock.
Join Now