Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Continuous Forms - per record button state

Status
Not open for further replies.

mj81

IS-IT--Management
Jul 22, 2006
3
GB
In a membership database I use continuous forms to display all members of a household. On each record I have a button to "pay subs" for that member. When an individual has "paid" - this is shown in a text box in the record - which references a public function call.

What I am attempting to achieve is when an individual has paid (i.e. the text box displays "Paid" that individual's "Pay Subs" button is "not enabled", but other individuals, who have not paid, still have active buttons.

Any ideas
 
Just to fill the gap for you. I think I am right, that any control status on a continuos form must be tied to an underlying table, otherwise it gets treated as one control. Regards
 
This is the way I do this.

1) Replace the button with a text box. Because you can use conditional formatting only on text boxes.
2) Use formatting to make the textbox look like a button
specialeffect = raised
backstyle = transparent
3) In conditional formatting
Expression is
[yourPaidFieldName] = "Paid"
enabled (which is a formatting option) = false
 
The other way to do this is to use the Oncurrent event of the form and you can leave it as a command button.

private form_current()
if me.yourfieldname = "Paid" then
me.cmdButtonName.enabled =false
else
me.cmdButtonName.enabled = true
end if
end sub
 
How are ya mj81 . . .

You could use your function in [blue]Conditional Formatting[/blue] to hiite the textbox (indicating not paid) say . . . red, for those that are unpaid. With this you could [blue]get rid of the buttons![/blue]

[blue]Your Thoughts?[/blue]

Calvin.gif
See Ya! . . . . . .
 
The way I solved this problem is to use the Toggle Button. Unlike Command Buttons, Toggle buttons have a Control Source and even when "unbound" bring the focus to the record the button resides on.

Use these as you would a command button on continuous forms. But the code will need the last line entered as "toggle=not toggle". See below:
Code:
Private Sub Toggle1_Click()
    ' _Code to execute_
    Toggle1 = Not Toggle1
End Sub

All lessons learned from the School of Hard Knocks........at least tuition is cheap.
 
Forgot to mention that it does have it's limits.

Disclaimer: The author is by no means responsible for any damage that comes to anyone that uses the above code, their computer, their neighbors, their kids, or their pets. Use of the code signifies affirmation of this disclaimer and removes the author from any legally binding responsibility for the above code.

All lessons learned from the School of Hard Knocks........at least tuition is cheap.
 
mishbaker . . .

You may not have done it before, but if you try [blue]Conditional Formatting[/blue] you'll wonder why you didn't!

[blue]We'll be here if you need help . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
Thanks people - I will investigate all the options raised above - It is not an essential fix - but would be "nice" to resolve.
At present on a key click I have to evaluate whether the button should have been disabled - if so pop a message - not ideal but it does prevent errors.

Michael
 
mj81 . . .

My prior post was mean for you! . . . not mishbaker . . .

Calvin.gif
See Ya! . . . . . .
 
I was given a task this morning along the same lines and in doing a search of the forums discovered this thread.

I tried MajP's technique with the command button by coding the following:

Private Sub Form_Current()
If me.code.value = "0000" Then
me.btnInspection.Visible = True
Else
me.btnInspection.Visible = False
End If
End Sub

The problem I'm having is that when I click on a row where the code="0000", the button displays on all rows. What I'm looking for it to do is for the button to appear only on the selected row and I thought this would work. Have I missed something in this thread?

If I use the second technique (text box) I'm assuming I can use the onclick event of the textbox to simulate a button push if I need to perform additional processing. Would that be correct? Also, if I use the textbox approach would it perform the same as the above with the command button that is a button on every row?

As with mj81, this is not essential, but would be nice.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top