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
0
Utf
2/3/2010 7:35:01 AM
access 16762 articles. 2 followers. Follow

1 Replies
484 Views

Similar Articles

[PageSpeed] 54

This is untested.
First set the subform's field Partners, then disable the subform.

This code would go on the after update event for the combo.

If Not IsNull(Me.cboCaseType) Then
    If Me.cboCaseType = "Personal" Then
        Me.[SubformControlName].Form.Partners = Me.[NameOfNameField]
        Me.[SubformControlName].Enabled = False

    Else
        Me.[SubformControlName].Enabled = True
    End If
End If


Note: replace cboCaseType with the name of your combo
- replace SubformControlName with your subform control, note that the name 
of the subform might be different from the name of the subform control.
- replace 'Partners' with your name for this field/control
-replace [NameOfNameField] with your name for this field/control.

When you say "Parent Form's field "Name".
If you do have a field called "Name", it is best to change it to something 
like FirstName or LastName.
Reason: "Name" is a reserved word in Access, in other the work 'name' means 
something different inside the workings of access.
If you use this for a field or control name, access will get confused and 
you will get an error in your code.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


"Faraz A. Qureshi" <FarazAQureshi@discussions.microsoft.com> wrote in 
message news:89F9067B-4BD6-40EC-B1AB-876DB5AE4577@microsoft.com...
>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 


0
Jeanette
2/3/2010 10:12:54 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...

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...

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...

tlh file getting archived upon creation?
I have no idea why. But I am sure that is why I get the following compile error; StdAfx.cpp o:\daltester1\stdafx.h(24) : fatal error C1083: Cannot open include file: 'o:\daltester1\debug\DataAccess.tlh': Permission denied Error executing cl.exe. DALTester1.exe - 1 error(s), 0 warning(s) any ideas? I uncheck the archived checkbox but as soon as I rebuild, the archive checkbox is set again. thanks, -greg Well, can you open the file? Have you tried looking at the .tlh file to see if it is really readable? And while it is interesting that an archive checkbox changes state, it woul...

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...

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...

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...

Field availability dependant on combo box choice
Hi, I have created a database that will be used amongst other things to raise purchase orders (PO). On my PO form I have a combo box which the user uses to specify if the order is for consumables, hire weekly, hire daily and delivery. What I want to happen is that if they pick either hire weekly or hire daily the field next to it becomes available into which they can specify the number of days / weeks, however if they chose any of the other options, the field is not accessible, or hidden. I know the answer is probably already listed somewhere, I'm just not sure what ...

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...

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...

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...

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...

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...

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...

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...

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....

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...