Inactivate a subform

I have the Parent Form with a field "CaseType" ComboBox with choice like 
"Business";"Personal"

I want the subform to become inactive if "Personal" is chosen on the parent 
form AND the SubForm's field "Partners" to acquire the same value as of 
Parent Form's field "Name".

An Event Code/Macro/guidance shall highly be obliged?
-- 
Thanx in advance,
Best Regards,

Faraz

0
Utf
2/3/2010 8:53:01 AM
access.formscoding 7493 articles. 0 followers. Follow

2 Replies
914 Views

Similar Articles

[PageSpeed] 54

I think this may work...

In the AfterUpdate event of the Partners control on the subform, run a check 
to see if the Main Combo = Personal and the sub's Partner = the parent's Name 
(I hope that's not actually the name of the field, being that Name is a 
reserved word (and a function to change the filename/path of a file)).  I 
will abbreviate the controls with "ctl", fields with "fld"...


(aircode - untested - will need null handling added)
Private Sub ctlPartners_AfterUpdate
  If (Me.Parent!ctlCaseType = "Personal") AND _
     (Me.ctlPartners = Me.Parent!fldName) Then

    'set the focus outside the subform and disable the subform's control
    Me.Parent!SomeControl.SetFocus
    Me.Parent!SubformControl.Enabled = False

  End If
End Sub


hth


-- 
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."  
-Thomas Edison (1847-1931) 



"Faraz A. Qureshi" wrote:

> I have the Parent Form with a field "CaseType" ComboBox with choice like 
> "Business";"Personal"
> 
> I want the subform to become inactive if "Personal" is chosen on the parent 
> form AND the SubForm's field "Partners" to acquire the same value as of 
> Parent Form's field "Name".
> 
> An Event Code/Macro/guidance shall highly be obliged?
> -- 
> Thanx in advance,
> Best Regards,
> 
> Faraz
> 
0
Utf
2/3/2010 10:59:01 AM
Thanx again Jack!
XClent piece of code quite broadening the horizon of concepts!
-- 
Thanx in advance,
Best Regards,

Faraz


"Jack Leach" wrote:

> I think this may work...
> 
> In the AfterUpdate event of the Partners control on the subform, run a check 
> to see if the Main Combo = Personal and the sub's Partner = the parent's Name 
> (I hope that's not actually the name of the field, being that Name is a 
> reserved word (and a function to change the filename/path of a file)).  I 
> will abbreviate the controls with "ctl", fields with "fld"...
> 
> 
> (aircode - untested - will need null handling added)
> Private Sub ctlPartners_AfterUpdate
>   If (Me.Parent!ctlCaseType = "Personal") AND _
>      (Me.ctlPartners = Me.Parent!fldName) Then
> 
>     'set the focus outside the subform and disable the subform's control
>     Me.Parent!SomeControl.SetFocus
>     Me.Parent!SubformControl.Enabled = False
> 
>   End If
> End Sub
> 
> 
> hth
> 
> 
> -- 
> Jack Leach
> www.tristatemachine.com
> 
> "I haven''t failed, I''ve found ten thousand ways that don''t work."  
> -Thomas Edison (1847-1931) 
> 
> 
> 
> "Faraz A. Qureshi" wrote:
> 
> > I have the Parent Form with a field "CaseType" ComboBox with choice like 
> > "Business";"Personal"
> > 
> > I want the subform to become inactive if "Personal" is chosen on the parent 
> > form AND the SubForm's field "Partners" to acquire the same value as of 
> > Parent Form's field "Name".
> > 
> > An Event Code/Macro/guidance shall highly be obliged?
> > -- 
> > Thanx in advance,
> > Best Regards,
> > 
> > Faraz
> > 
0
Utf
2/3/2010 11:08:01 AM
Reply:

Similar Artilces:

Inactivating Vendors
Trying to inactivate a vendor, get the message: This vendor has been assigned to a purchase order or an unposted receipt, the status cant be changed to inactive. I have checked and the 2 PO's are closed, and there are no open receivings. What do I have to do to inactivate this vendor? thanks! -- Doug You have to run the Remove Completed Purchase Orders process (Tools-Routines-Purchasing) in order to move closed or cancelled purchase orders to history as long as you are keeping PO history. "Doug" wrote: > Trying to inactivate a vendor, get the message: > &g...

Lookup in subform
Using Access 2003 I have a table of medical practices and a table of physicians and the corresponding forms. The form for the physicians is a subform in the form for practices as one practice can have multiple physicians. A lookup was created to find the practices in the form. Now a lookup is needed for physicians. What is the best way to create a lookup for a physician (whose information is in the subform) and have it sychronize to the correct the practice form? Hi, In the RowSource for your combobox, you could have something like: SELECT ID, FirstName, LastName FROM tblP...

subform problems
Does anyone know how to make a button on the mainform delete the records showing on its subform which is in datasheet view? Thanks for the help! -- Michael Michael: You can execute an SQL statement in code which deletes all rows from the table on which the subform is based where the value of the foreign key column which references the primary key of the parent form's table has the value of the parent form's current record's primary key. Then you'd requery the subform control. Say the subform is based on a table Orders with a foreign key CustomerID which references th...

Continuous subform behavior
Greetings all, I have a continuous subform on an unbound form that I want to be able to edit records. When I click into to a text box on the subform and begin to edit the text, I can edit, but the original text gets deleted as soon as I start typing. The record is not deleted, just the data in the field linked to the text box. The form's data entry and allows additions are set to "no" and allow edits and deletions are set to "yes". I would like to be able to click into the textbox and freely edit without the original data being deleted. Any ideas what...

subform problems 06-12-07
Does anyone know how to make a button on the mainform delete the records showing on its subform which is in datasheet view? Thanks for the help! -- Michael Create a query based on the table or query that is the rowsource of the subform. The query should include the Linkchild field of the subform. Set the criteria of that field to: Forms!NameOfMainForm!NameOfLinkMasterfieldOfSubform Change the query to a delete query. Create a button on the main form and in the On Click event open the query. PC Datasheet Providing Customers A Resource For Help With Access, Excel And Word Applications res...

Go to specific row in Subform datasheet
I have a main form with several subforms, one being a datasheet that lists monthly billing periods with cost information. I am trying to write a statement that will start the datasheet at the row that is 3 months prior to the current month so we dont have to scroll down to get there each time (I currently have a 69 month spread, and we are on about month 30; the form displays about 15 at one time). I need all the months to show up, so a filter won't accomplish what I am looking for. I have created a SQL statement that returns the BillingPeriodNumber, and I want the datasheet to 'got...

Linking 2 Subforms
After reading several posts on these forums, I am beginning to think that what I would like to do is impossible. I don't know if anyone can point me in the right direction or not, but here goes. I currently have a form with 2 subforms (both in datasheet view). The main form has combo boxes that filter the results in the first subform. I would like to be able to select a record in the first subform and have on the related records shown in the second subform. I believe this has something to do with Parent-Child links, but i know that you cannot have a parent-child link between 2 ...

How do I tab from subform to subform?
Hi I have a form Order Form, with subforms Customer Details and Order Details. When the user uses the tab key, after the last field in Customer Details, it goes on to the next customer details record. What I want it to do is to go to the first field in the Order Details section. How can this be achieved? Stapes On Wed, 9 Jan 2008 07:02:39 -0800 (PST), Stapes <steve.staple@gmail.com> wrote: >Hi > >I have a form Order Form, with subforms Customer Details and Order >Details. When the user uses the tab key, after the last field in >Customer Details, it goes on to the next ...

Inactivating a vendor
I would like to change the vendor status to inactive, but get the message: This vendor has been assigned to a purchase order or an unposted receipt, The status cant be changed to inactive. i have checked and all PO's are closed or cancelled, and there are no open receipts. Havent used this vendor for over a year. Do I have to do something else to change a vendor to inactive? -- Doug You need to run the PO Removal Routine (Tools-Routines-Purchasing-Remove Completed Purchase Orders) for the Vendor ID you are having the issue with. This will move the PO info to history and allow y...

How to Inactivate a Kit
Hello, I'm looking for recommendations on what is the best process to inactivate a kit so it is no longer available to sell? Thanks! Jeff Couple options: 1) GP does not keep or track history of kits in any way shape or form, so you can delete the kit. or 2) Change the kit components to discontinued and you can either disable or password protect the "Allow Sales of Discontinued Items" in the Sales Order Processing Setup Options window. There is no way to inactivate a kit directly. If deleting the kit or changing the kit components to discontinued i...

Generic reference to form's control containing a subform
Hi, From within subform's code I would like to access the tag property of the parent's form control which contains the subfrom. I know how to do it when the subform code knows the exact name of the control which contains the subform: Tag = Me.Parent!subformContainerControlName.Tag However, in my case the same subform can be included in many different subformContainer controls. So I woulld like to have a generic code in which I refer to the subformContainer control wihtout using its specific name. Similarly to how I can refer to a parent form (e.g. me.Parent) witho...

Filter in MainForm and SubForm
Hi All, For my daughter's primary school, I'm writing some kind of admin application. While doing this, I have the next question. I have two tables: - TblParents, which has (amongst others) fields [ID_Parents] and [FamilyName] - TblChilds, which has (amongst others) fields [ID_Parents], [FirstName] and [FamilyName] There's a relation: both have field [ID_Parents] In the main form (FrmParents), there is a subform (subFrmChilds), linked with [ID_Parents]. This works fine. In this form, there is a text box [StrFilter], which is the input for a filter. What I want is that this...

Customer-Inactivate but do not remove history
Does anyone have any suggestions on how to handle a customer that we no longer want to use, but i dont want to remove history. (Looks like I cant inactivate a customer if there are posted or unposted transactions) thanks -- Doug Doug, If all transactions for this customer are fully applied, you can move them all to history (Tools > Routines > Sales > Paid Transaction Removal) and then Inactivate the customer. (Note: make sure History tracking is turned on before you run the Paid Transaction Removal.) If you still have open transactions or don't want to move them to...

Info in subform showing up multiple times..
I have created a report that will summarize all of my invoices that are in the Invoice form. My problem is that in the report it is showing all of the seperate charges on the same invoice. Say if there is 3 charges on the one invoice, that invoice comes up 3 times on the report. I can get the report to show the invoices only one time, but I need the netamount in the report also. In order for the netamount to be shown I need the quantity and unitprice in the report, causing the problem of the charges coming up more than once... Can someone please help me? -- Message posted via AccessMonster.c...

filter subform created from query
Hi, How can i filter a subform created from a query with an unbound combo box? Thanks -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200802/1 Put a WHERE clause in your subform's record source query to filter on the value of the Combo Box: WHERE [SomeField] = Forms!MyFormName!MyComboName Then in the After Updat event of the Combo: Me.MySubformControl.Form.Requery -- Dave Hargis, Microsoft Access MVP "spiz via AccessMonster.com" wrote: > Hi, > How can i filter a subform created from a query with an unbound co...

Filtering Subform
I would like to apply a simple filter to a subform from the Mainform. Main From = SearchPage Sub Form = Cat Codes subform Filter Box = Text49 Filter Field = Definition Filter Command = Command51_Click Code that I’m trying to use and is not working. Results is a blank subform with no filtered records. Private Sub Command51_Click() Me.[Cat Codes Subform].Form.Filter = “Definition =’” & Me.Text49 & “’” Me.[Cat Codes Subform].Form.FilterOn = True Me.[Cat Codes Subform].Form.Refresh End Sub NOTE: definition is a group of words so I need to be able to search for any word within the fiel...

subform not updating a subdatasheet correctly
Hi, I have a form with a subform that is linked to a subdatasheet. When I enter multiple records into the subform it does not keep all the records under the correct datasheet record, it spreads them out across all the other records. I'm thinking this is because of the autonumber function for the record number. How do I have access autonumber these records correctly so when I open the subdatasheet the correct subform records are attributed to the correct subdatasheet record? Thanks, Cristen Subdatasheets are useful only for end-users who work from datasheet view (an...

Inactivate Accounts
I want to inactivate a couple of hundred of accounts that we don’t use any more due to some branch closures. Our account string consists of 4 segments and the second segment denotes the branch. Unfortunately you can not do this via Mass Modify since you can not use wildcards for the main accounts segment (first segment). I know you can only inactivate an account if it has a zero current balance. It will take me hours to open each account in Account Maintenance and inactivate them one by one. What I was thinking of doing is run a trial balance for each branch to make sure there are n...

subform information allocate to other form's textbox
hi, I designed 2 forms in a *.mdb recently, and now, i want to move all the information from "Form 2" into a text box of the "Form 1", how can I do it? And how can I design the things such as the allocation of the requested item within the text box? Thanks ...

Inactivating records
I wanted to run this by you all and see if I'm approaching this the "best" way, and I know "best" can be subjective. :-) I have look-up tables which serve to populate comboboxes in data entry forms and standardize data entry... A user can also add more values to the list in the look up table (via another form). For example, a lookup table of WaterColor will have fields of WaterColorID (primary key set to autonumber) and WaterColor (green, brown, blue). If someone wanted to refine the green color further to more specific green colors, say "aqua gr...

Trying to Inactivate a Vendor
I would like to inactivate a vendor, but get the message: You can not inactivate a vendor because it has posted or unposted transactions. What do I have to do to inactivate a vendor? -- Doug Doug, I believe to inactivate a vendor, they cannot be on unposted transactions and cannot have unpaid transactions (I think this is what the message means by 'posted') - is either of those the case? -- Victoria Yudin Dynamics GP MVP Flexible Solutions, Inc. "Doug" <Doug@discussions.microsoft.com> wrote in message news:0266721B-87A9-49BF-A7FC-3EB3C2373706@microsoft.com....

Inactivate a subform upon a choice.
I have the Parent Form with a field "CaseType" ComboBox with choice like "Business";"Personal" I want the subform to become inactive if "Personal" is chosen on the parent form AND the SubForm's field "Partners" to acquire the same value as of Parent Form's field "Name". Any idea/Event Code/Macro/guidance shall highly be obliged? -- Thanx in advance, Best Regards, Faraz This is untested. First set the subform's field Partners, then disable the subform. This code would go on the after update event fo...

SubForm in Tab Control Not Refreshing
I have a form with tab controls. On first tab is a subform. The subform populates records based on query with parameter from a combo box on the same tab. Problem is the subform doesn't refresh after combo box selection is made. Ive tried numerous combinations of me.setfocus and Me.refresh and me.requery and repaintobject unsuccessfully, the data does refreshe successfully after I close the form and re-open form. I've done my due diligence and searched this board and others and have found the following as the most common resolution: Forms!MainFormName!subformName.Form.Requery For...

Form, Subform, and Record Navigation
It seems that when a subform displays in datasheet view, and the focus gets to the new record row, if I continue to press the <Enter> key, when the last field is reached, the focus transfers to the main form and goes to the main form new record (or next record). But in my other form, where the subform is a continuous form made to look similar to datasheet view, when a new subform record is reached, and the <Enter> key pressed repeatedly until the last field is reached, the focus stays in the subform, and simply moves to the first field in the new record row. How can I get the lat...

Change subform from a subform
I have a form named frmToday with a subform named frmMyView. The default subform for frmMyView is frmCalls. I change this with a button by using a private Sub routine Forms!frmTODAY!frmMYVIEW.Form.SourceObject = "frmDupes." I have a button on frmDupes with Forms!frmTODAY!frmMYVIEW.Form.SourceObject = "frmCalls" as a Private Sub routine. The intent is to change back to the original setup. It doesn't work. What do I need to do? Thanks! ...