By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,155 Members | 2,518 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,155 IT Pros & Developers. It's quick & easy.

Buttons for Each Row in a form

P: n/a
Hi all ,

I'd appreciate anyone insight on this

I have created a form that fetched rows from a query. On each row I
have added buttons to execute command for that relevant row only. The
Form displays all rows fetched in tabular format.

Now one of the data fetched is a Yes/No Value , When it is true it
should hide some of the buttons and make some visible.

I have written that routine but I dont know on which event shall i
place it at. When I put it at (form on load) it says object undefined.
?! any clue

Private Sub is_approvedBox_(### What Event ###)(Cancel As Integer)

If (is_approvedBox.Value = -1) Then
QualifyLeaveCmd.Visible = False
DeleteLeaveCmd.Visible = False
PrintReport.Visible = False
EditLeaveCmd.Visible = True

Else
PrintReport.Visible = True
QualifyLeaveCmd.Visible = True
DeleteLeaveCmd.Visible = True
EditLeaveCmd.Visible = False
End If
End Sub
Will I also need to pass a variable to the button when i click it
stating which row it belongs to ?
I'm confused.
Thanks Again

Regards

Alya

Nov 28 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
In a continuous form, you cannot hide the buttons on some rows but not on
others.

You may be able to simulate this if you used an unbound text box instead of
a command button. Set its Control Source to the text you want to appear as
the "label" on the button, e.g.:
="Click Me!"

You can then use Conditional Formatting (CF) of the text box to simulate a
disabled look, by changing the ForeColor to a grey and changing the
BackColor. The CF does work on different rows.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<al******@gmail.comwrote in message
news:11**********************@l39g2000cwd.googlegr oups.com...
Hi all ,

I'd appreciate anyone insight on this

I have created a form that fetched rows from a query. On each row I
have added buttons to execute command for that relevant row only. The
Form displays all rows fetched in tabular format.

Now one of the data fetched is a Yes/No Value , When it is true it
should hide some of the buttons and make some visible.

I have written that routine but I dont know on which event shall i
place it at. When I put it at (form on load) it says object undefined.
?! any clue

Private Sub is_approvedBox_(### What Event ###)(Cancel As Integer)

If (is_approvedBox.Value = -1) Then
QualifyLeaveCmd.Visible = False
DeleteLeaveCmd.Visible = False
PrintReport.Visible = False
EditLeaveCmd.Visible = True

Else
PrintReport.Visible = True
QualifyLeaveCmd.Visible = True
DeleteLeaveCmd.Visible = True
EditLeaveCmd.Visible = False
End If
End Sub
Will I also need to pass a variable to the button when i click it
stating which row it belongs to ?
I'm confused.
Thanks Again

Regards

Alya

Nov 28 '06 #2

P: n/a
Hi there

A slightly left field take on this! but...

If you put your buttons elsewhere on the form rather than within the
record row itself and given that the action behind the button can
easily be made to apply only to the currently selected record then you
can switch the buttons on and off depending on the values in the
current record using the onOpen and onCurrent events to your hearts
content! I find it's rare that you need to have the buttons actually
inside the row itself especially when the user usually needs to select
a row anyway!

Purpleflash

al******@gmail.com wrote:
Hi all ,

I'd appreciate anyone insight on this

I have created a form that fetched rows from a query. On each row I
have added buttons to execute command for that relevant row only. The
Form displays all rows fetched in tabular format.

Now one of the data fetched is a Yes/No Value , When it is true it
should hide some of the buttons and make some visible.

I have written that routine but I dont know on which event shall i
place it at. When I put it at (form on load) it says object undefined.
?! any clue

Private Sub is_approvedBox_(### What Event ###)(Cancel As Integer)

If (is_approvedBox.Value = -1) Then
QualifyLeaveCmd.Visible = False
DeleteLeaveCmd.Visible = False
PrintReport.Visible = False
EditLeaveCmd.Visible = True

Else
PrintReport.Visible = True
QualifyLeaveCmd.Visible = True
DeleteLeaveCmd.Visible = True
EditLeaveCmd.Visible = False
End If
End Sub
Will I also need to pass a variable to the button when i click it
stating which row it belongs to ?
I'm confused.
Thanks Again

Regards

Alya
Nov 28 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.