need to lock button based on subform

HRakibul

Registered User.
Local time
Today, 06:31
Joined
Feb 10, 2014
Messages
41
hello guys,
i got a problem about form designing. i need to disable my Close Command button while my subform Price cell is null and enable the Delete button.

and while delete button is pressed the delete action occured and close button enabled.
 

Attachments

  • Untitled.png
    Untitled.png
    22.5 KB · Views: 95
  • TestDb.accdb
    TestDb.accdb
    592 KB · Views: 75
What's the Close button for? And the Delete button relates to the subform right?
 
hi dear,
the Close button will be used for closing the form. and delete button is used to delete the buyer order and whole co-related records.
 
Ok, got you.

1. Disabling the close button won't help your cause. Your subform has multiple records so if one of the records in the subform for that field is Null and another isn't Null then the user can simply move to the non Null record to enable the Close button.
2. As for the Delete button put some code in the Current event of the subform and the After update event of the FruitPrice field to change Enable property of the button on the main form.

Here's a link on how to refer to controls:
http://access.mvps.org/access/forms/frm0031.htm
 
hi vbaInet,
i think i could not make u understand the problem. in the subform the two fields ared dependable. the Second field Grade is dependant on the firest field Fruit and when the Graded is updated then the price of that grade will be look up on the price cell.

now the problem is if there is no price of the grade then the FruitPrice cell will be null. in that case i need to disable the close button
 

Attachments

  • Untitled.png
    Untitled.png
    37.6 KB · Views: 68
Is this what your asking for?
If IsNull (Me.FruitPrice) Then
Me.CloseButton.Enabled = False
Else
Me.CloseButton.Enabled = True
Me.DeleteButton.Enabled = True
End If

HTH
 
Is this what your asking for?


HTH

your solution shows "Invalid Qualifier" error message.
:banghead::banghead::banghead::banghead::banghead:
 

Attachments

  • error msg.png
    error msg.png
    82 KB · Views: 119
Of Course you need to change the field names to match your own!
 
hello burrina,
Please follow my post from the begning....
 
hi buddy,
can u simplify u r link. i could not understand. can u apply ur suggestion on my access database
Hello pal,
If you're given advice and there's something you don't understand, it's best you ask instead of saying "it's too difficult" or "i don't think you understood my problem" or "please read my post from the beginning". On a forum, those sort of replies won't get you anywhere.

First of all do the design change I suggested. Do you need to have the subform in Datasheet view or can it be in Continuous form?
 

Users who are viewing this thread

Back
Top Bottom