Enable Main Frm Cmd Button When Subfrm Is Dirty
Sep 30, 2006
Hi,
Haven't used the 'ondirty' property before and am having trouble with it.
I have a main form (PersAction) with a subform (PersAction_PersData). After Insert button is click, subform appears ready for new data. click save works great. I wish to have an undo button on the main form become visible once data is entered into the subform. I've tried the following code in both the main form and subform 'Ondirty' property as an event and no luck:
If Me!PersAction_PersData.Dirty Then
Me!cmdUndo.Enabled = True ' Enable button.
Else
Me!cmdUndo.Enabled = False ' Disable button.
End If
Any help would be appreciated
thanks in advance
Hawg1
View Replies
ADVERTISEMENT
Jun 19, 2006
I did a search in the form forum and couldn't find anything close that had a response.
I have a parent form and a sub form.
I have the parent set up to make the enable property false for the command buttons that aren't appropriate when you first open the form: Like Save and Undo.
I want to do the same for the child form, which has different data linked to the parent form.
The parent form always grays out the inappropriate boxes.
The subform will gray them out only if I open it as a stand-alone form. When I put the code in the Open, or Load or Gotfocus events I get an error message that it cannot locate the subform.
Any ideas where to go?
Thanks-
View 2 Replies
View Related
May 20, 2015
I have written code to look up a value in a table that then enables or disables a subform in my main form. The code works, but I know it is now as efficient as it can be. The main problem is that I have multiple values that determine if the subform should be enabled or disabled. I would like to use an IN statement but I'm pretty sure this doesn't work for Dlookup. Below is an example of the code I currently have:
Code:
Sub enablecontrols(setting As Boolean)
Inv_subform.Enabled = setting
End Sub
Private Sub Form_Current()
[Code] ....
Like I said, this works fine, but I am concerned if I need to add more items to look up and the stability of the code in general.
View 3 Replies
View Related
Sep 9, 2005
I have a parent form containing a subform (Datasheet view). The parent form also has a button that I only want enabled when there are records showing in the subform.
Were the records contained in a listbox (as opposed to a subform) - I could simply check the recordcount property but short of running SQL to count the number of records in the underlying table - how can I do this?
Any ideas please?
View 1 Replies
View Related
Oct 10, 2005
hey I have a requirement to switch on or off the toggle filter button depening on who the current user is.
I can id the current user no problem - my issue is how do I swicth this button on and off??
thanks
Martyk
View 6 Replies
View Related
Jul 27, 2012
I have a form. and it has three buttons. Such as Submit, Reject, Under Observation.
I want :
1) If i click SUBMIT button it will be disable and other two buttons REJECT and UNDER OBSERVATION will be enable
2) If i click REJECT button it will be disable and other two buttons SUBMIT and UNDER OBSERVATION will be enable
3) If i click UNDER OBSERVATION button it will be disable and other two buttons SUBMIT and REJECT will be enable
View 1 Replies
View Related
Aug 10, 2015
I have all of my text fields disabled and I want the user to press a button to make them enabled. I have a field that links to the database called, "lastName".Under the button's clicked property, I have coded,
Private Sub Command44_Click()
lastName.Enabled = true
End Sub
View 12 Replies
View Related
Apr 5, 2014
I have a button on a form that when I press it, I want it to validate a user's Windows Login ID in a text box on the current form against a table before allowing them access to a form.
If the Login ID in the text box does not match any value in the table I have defined, I wanted a MsgBox displayed saying invalid credentials. Of course if the ID exists in the table, I'd like it to open the next form.
View 4 Replies
View Related
Mar 9, 2012
Objective: After each field in my form is completed, I want my NewSave button to be enabled.
Problem: Created an if/then code that disables the button but never re enables it after conditions are met
Code:
Private Sub Form_Current()
Dim promptmsg As LongÂ
If IsNull(Me.ContractValue) = False And IsNull(Me.ContractNumber) = FalseÂ
And IsNull(Me.InvoiceDate) = False  Then Me!NewSave_Button.Enable = True Â
[Code] .....
View 5 Replies
View Related
Aug 12, 2013
I'm trying to have a button in a form that, when clicked, will time stamp a text box already formatted for time. But once the text box is filled with a time, the button then disables itself for that record.
If I switch to another record where the text box is empty, the button will enable itself without closing the form, but obviously re-disable itself if I go to a record the text box is filled.
I'm sure I could use conditional formatting for it, but I don't think I'm going about it the right way. I already got a basic button built to timestamp.
View 5 Replies
View Related
Oct 14, 2014
I have a simple listbox (single column, no multi-selection).I want to enable a command button when the user selects an item in the listbox / disable it if no items are selected.I'm using the AfterUpdate event of the listbox, as follows :
Code:
Private Sub lstOptions_AfterUpdate()
Select Case Me.lstOptions.ItemsSelected.Count
Case 0
Me.comConfirm.Enabled = False
Case Else
Me.comConfirm.Enabled = True
End Select
End Sub
But when I select an item from the listbox, and debug the code, the Count is always zero? Even though I can see the item selected??
View 2 Replies
View Related
Sep 22, 2013
I have a form "Handover" on this form I have a button that enables edit functionality once clicked, I now have a subform on this form named "Bdown".
The Bdown subform allows edits without having to click the "btn_Edit" on the main form "Handover".
Is is possible to make the edit button on "Handover" control the edit function on "Bdown" also?
Currently "Handover" contains:
Code:
Private Sub btn_Edit_Click()
Me.AllowEdits = True
Me.btn_Edit.Caption = "Editing"
End Sub
[Code] .....
View 2 Replies
View Related
Mar 25, 2013
Basically I want to put a code in the "on load" event of a form that enables or disables navigation buttons based on a value in a table (the table has 1 record and 1 column).
So if the value is "A", I want to hide navigation buttons on load; if it is "B", I want to show navigation buttons on load.
I know I can set this property in each form, but I have a number of forms that I want to configure at the same time.
My problem is that I don't know how to reference the value in the table.
View 3 Replies
View Related
May 20, 2015
I have 3 macro importing 3 files, and then another button to process those data.
So, I need a function to enable/disable the button depending on the files have been imported or not.
View 1 Replies
View Related
Jun 24, 2015
I have a database with a Main Menu Form, containing a Button that loads my main data entry form. When the Button is Clicked portions of the data entry form that is loading shows through the Main Form Background (e.g. portions of the navigation bars, and portions of the boarder on the form that is loading.)
View 5 Replies
View Related
Jul 26, 2006
Please help,
I have more than one cancel button which is made visible depending on the previous form that has opened the current form.
ie. on Form1
FORMS!frmSub!cancelbuttonfrm1.visible=true
or Form 2
FORMS!FrmSub!cancelbuttonfrm2.visible=True
I want it to run an undo before closing, undo the previous form and close back to the mainmenu. However if the form isnt dirty (No changes have been made) then when the undo is called i get a run time error.
So why not do it as on dirty cancelbuttonfrm1.visible=true i hear you ask, well how can i make different buttons visible dependant on the previous form?
Obviously Access knows that the form is dirty because it triggers the undo or do you want to save.
So can i not just do 'IF Frmsub is dirty then undo else close form'
View 3 Replies
View Related
Oct 11, 2007
Hello,
I attached a db to better display what I'm attempting to do. How can I get fld1 in subfrm1 (which is in column view) to display the same data in subfrm2 (which is in tabular view)? --
so if I click on the text displaying "dog" in subfrm1, subfrm2 displays "dog" row. If I click on "cat", subfrm2 displays "cat" row?
View 8 Replies
View Related
Jan 10, 2005
guys..idesperately need some helphere. i have a form,and when someone is scrolling through the records, if they make a change in it, and then when they try to move to another record, i would want to prompt them to save their changes. however, the me.dirty property seems to be working erratically. some changes cause it to be true, and some don't. i suspect this isbecause i use a me.refresh which causes the me.dirty to be false even when i make changes.
what can i do about this? if the user doesnt choose to save their changes, can the changes be undone aftera me.refresh?
View 1 Replies
View Related
Jun 8, 2005
I am having trouble keeping focus on a field in a subfrm when I click the next button for the next record.
I have a frmQuiz. This shows the quiz question. I have a subfrmUserAnswers, where the user enters the Answer ID in the field UserAnswerID. This form clears to a new record when the Next button is pressed for the next question and the focus is lost.
How can I maintain the focus?
View 1 Replies
View Related
Apr 5, 2005
:confused: Want code to run when only year-part of date is dirty, but it's not working. Any idea?
Private Sub DateField_BeforeUpdate(Cancel As Integer)
If (right(Me. DateField, 4)) = Dirty Then (code runs at all changes)
‘If (Format(Me. DateField, "yyyy")) = Dirty Then (code runs at all changes)
‘If (year(Me.DateField)) = Dirty Then (code not running)
If DCount....
Me.IDnr = Nz(DMax....
End If
End If
End Sub
View 2 Replies
View Related
Aug 24, 2006
I have a form that has names with a subform with information. The contacts are in a list box and the subform (in datasheet view) shows the phone number/email/etc.. of the selected contact person. I am using the form as a quick look up of a persons information. Before changing it to a list box, it was previously a combo box, and everything worked fine. i was able to requery the subform and the cooresponding info for the person would come up. However, its now a list box and i am having problems with the code to make this happen. I have a different button sending the names selected from the list box to a report...and that works fine, but i am obvisouly missing something to make it work with the subfrm requery. Below is the code i got so far. Any help would greatly be appreciated. its driving me nuts!
Private Sub QuickLookup_Click()
Dim varItem As Variant
Dim strWhere As String
strWhere = "[memberID] = "
For Each varItem In Me.MemberID.ItemsSelected
strWhere = strWhere & Me.MemberID.ItemData(varItem) & " OR [memberID] = "
Next varItem
strWhere = Left(strWhere, Len(strWhere) - 17)
DoCmd.Requery "subfrmqryindividual"
View 2 Replies
View Related
Aug 18, 2006
How do i make my subfrm record source switch to another saved query (qryPendingStatus) when it's opened from the form.
Heres what i am trying to accomplish:
I have a subfrm that i'd like to use to display info in 2 different forms.
There's a form currently for All statuses. Then another new one for Pending status. I'd like to use the same subform for this pending status form also, and in doing that my qryAllStatuses, but change to qryPendingStatus on the subfrm when i open the mainfrom.
This is on the open even ofthe mainform, but does not work (says method not founds...so obviouly i can't use ".Recordsource" here:
Private Sub Form_Open(Cancel As Integer)
Me.subfrmJobInfo.RecordSource = "qryPendingStatus"
End Sub
How can i make this happen?
View 3 Replies
View Related
Jun 23, 2005
My subform when i click the New record button on the subform i want it to disable a text box that is on the main form.
Me.Pensioners.Form!quicksearch.Enabled = False
where Pensioners is the name of the Parent Form. Thhis isnt working for one reason or another. Please advise.
View 3 Replies
View Related
Jan 12, 2014
Is it possible to clear filters set on a subform using a button on the main form?
View 1 Replies
View Related
Jun 24, 2013
I am trying to create a command button that will delete the current records in both the subform and main form.
I know how to create a command button that will delete the current record of which ever form I'm in (either the sub or main form) but I wish to do so both at the same time with one event procedure. I currently have been experimenting with a button in the subform but I don't really care if it's in the subform or main form.
View 2 Replies
View Related
Jul 1, 2013
What i'm trying to do is add a new record to a subform. The problem is, I couldn't use a subform based on a table in order to achieve this. I needed extended information for it to be useful, so I made the visible part of the subform based on a query instead.I'd like to add a button that adds a new object to the main job. I'd like the adding of that button to call a new form allows you to fill in the information for that object (this called form actually contains 5 subforms to populate all the data of the object). That form works.
What I need is for the button to call the 2nd detailed form AND create the necessary entries in the project/object junction table.The idea as it is now is a button on the main form, but if it was possible to do so via continuous form in a subform, that's doable.
View 11 Replies
View Related