How to add record in Subform which is in another Subform

Hi all, I have Subform "SubA" on another Subform "SubB".  And "SubB"
is on Form called "Main".  On "SubB" I have button called "Add New
Record" and I got macro (see below) on this button's click event.

Private Sub Command1_Click()
Me.SubA.SetFocus
DoCmd.GoToRecord , , acNewRec
End Sub


When I open Form "SubB" and click button, macro works but when I open
Form "Main" and click button which is showing in "SubB" subform,
macro
don=92t work.  I tried below macro but I don=92t work


Private Sub Command1_Click()
Forms![Main]![SubA]![SubB].SetFocus
DoCmd.GoToRecord , , acNewRec
End Sub


Please can any friend help


0
K
5/25/2010 2:41:59 PM
access.tablesdbdesign 510 articles. 0 followers. Follow

1 Replies
773 Views

Similar Articles

[PageSpeed] 42

First, those are VBA procedures, not macros.

Why are you adding a new record to another subform?  Why not go to that
subform to add the record, since you need to go there anyhow to enter data?

Maybe you could do something like this from SubB:

Me.SubA.Form.Recordset.AddNew
Me.SubA.SetFocus

This syntax is incorrect on several levels:
Forms![Main]![SubA]![SubB].SetFocus

The hierarchy is Main >> SubB >> SubA (where SubA is a subform on SubB).  The
fully qualified syntax would be:

Forms![Main]![SubB].Form![SubA].SetFocus

From the main form you could do:

Me.SubB.Form.SubA.SetFocus

or

Me!SubB.Form!SubA.SetFocus

However, from SubB the syntax I provided initially should work, since SubA is
a subform control on SubB.

K wrote:
>Hi all, I have Subform "SubA" on another Subform "SubB".  And "SubB"
>is on Form called "Main".  On "SubB" I have button called "Add New
>Record" and I got macro (see below) on this button's click event.
>
>Private Sub Command1_Click()
>Me.SubA.SetFocus
>DoCmd.GoToRecord , , acNewRec
>End Sub
>
>When I open Form "SubB" and click button, macro works but when I open
>Form "Main" and click button which is showing in "SubB" subform,
>macro
>don’t work.  I tried below macro but I don’t work
>
>Private Sub Command1_Click()
>Forms![Main]![SubA]![SubB].SetFocus
>DoCmd.GoToRecord , , acNewRec
>End Sub
>
>Please can any friend help

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-tablesdbdesign/201005/1

0
BruceM
5/26/2010 2:09:11 PM
Reply:

Similar Artilces:

Add Lookup Fields to Entity
I need to add 4 "technical contact" fields (which would lookup the Contact entity) to the CONTRACT form. Is this possible? I've found it difficult to figure out what to do first. Thanks in advance, Brandon Not possible. You cant have multiple lookups for the same entity. You also cannot create new relationships between two system entitites. This will work in 4.0 Not possible, Pezman. N:M relationships are not possible in 3.0 yet. There is a alternative solution: a new entity to act as an N:M relationship. In your case, Contract/Contact. This entity has two 1:N relations...

sql cmd exporting value of checkbox into another checkbox
I have some code elsewhere on my db that i use to export some values from one table into one that isn't loaded on the form, and I need to do a similar technique elsewhere. However, I need to export the value of a checkbox on the form, to the related "nBookingID" checkbox in the table. this is the working code for adding a new booking and entering in the nDayBookingID for future reference If Check135.Value = -1 And DCount("*", "tbl_TRA_DAYComplete", "[nDayBookingID] =" & Me.anDayBookingID) = 0 Then sql = "" sql = sql & &quo...

count records in a date range
I have a worksheet in which I am trying to count the number of records in a date range. For example, the Submit_Date column contains the following dates/times (cells a1:a5): 12/17/2005 12:00:54 PM 12/16/2005 1:00:54 PM 12/17/2005 9:00:13 PM 12/10/2005 7:54:16 AM 12/17/2005 10:04:11 AM I would like to count the number of records with a Submit_Date between 12/1/2005 12:00:00 PM and 12/31/2005 11:59:59 PM. Any suggestions? -- Jim -- Jim You can use SUMPRODUCT =SUMPRODUCT((A1:A100>=B1)*(A1:A100<=B2)) A1:A100 ....date range B1 start date B2 end date HTH JG "jiml"...

Excel Add Ins
What is the name of the template wizard with Data Tracking (Excel. I can not locate the add in template wizard with Data Tracking in Office 2003 Hi Richard You are not the only one<g> The Add-in is working in 2003 only the install file is not working. Copy the xla file from a PC with 2002 to the PC with 2003 and it will work(use Tools>add-ins to browse to the file in Excel) -- Regards Ron de Bruin http://www.rondebruin.nl "Richard" <Richard@discussions.microsoft.com> wrote in message news:193C5DFD-578D-48F7-B9D6-9FEF5BDCEB64@microsoft.com... > What is t...

Creating Replicas of Public Folders from another forest
Hi We have just migrated our Exchange 5.5 organisation to 2003 - following the deployment tools etc. All went well. Now we have to merge another forest's exchange with ours - well, create a replica of their public folders onto our Exchange Server. Once this is in place we will join the users (only 10) from the other forest with ours. We are not using the ADMT as we thought we would just create new accounts etc for them in our forest. What is the best way to replicate these public folders to our domain? Regards and thanks Ashleigh -- IT Administrator You should be able to u...

Record Deleted
I am attempting to write a simple query and when I choose the information in ascending order I am receiving an error message that states a record has been deleted and will not provide the report. I'm finding that I'm receiving this message on several already created queries. How can I correct this without losing information? The only change has been the relocation of the file to another folder. Are you talking about the main .mdb file that's been moved? Is the database split? If so, have you relinked the tables after moving the file? Do you have full permissions to the fol...

Transfering data from 1 worksheet to another
I have several worksheets that are used to input data into to a summary worksheet for a golf league One of the worksheets is a schedule. The schedule worksheet has 18 columns (one for each week) and the 32 rows have the team's tee positions and opponents for that week. When the summary worksheets is printed each week it has the current weeks schedule shown. I would like to be able to have the current week's scheduled transfered to the summary sheet by identifying the week number and have the data transfered from the schedule worksheet to the summary worksheet. I tried the lookup...

How do I move an Exchange mailbox from one user to another?
I'm new to Exchange and my first task proved to be a bit more than I could chew: One of my users, lets call her Annie, has two NT accounts in my domain: AnnieA and AnnieB. AnnieA has email address AnnieA@MyDomain.com and AnnieB doesn't have email. Now I want to remove account AnnieA and let AnnieB inherit AnnieA's email address and mail box. How do I do this? Thanks! /Carl What version of Exchange? In 5.5 you can just go to the mailbox properties and change the user account associated with the mailbox. In 2000 you use ADU&C to right click >exchange tasks >remove mai...

Add on
Hello, Here is a scenerio. A client is buying 1lb of ham. It is put on a waxed paper then wrapped into a white paper and then put into a shopping bag. The usage of shopping bag is 100% cases the usage of paper is only with certin categories of sales. Same with the waxed paper. Question: Is there a way of associating wax paper, white paper and shopping bags in a way so with every sale a piece of paper gets deducted from inventory and one bag is deducted from inventory? I would like to run a report every so often and see if I need to purchase any supplies. Kits and assembly do not work...

add a row or column to a single cell in exel
I am trying to split a single cell into 2 rows can you help If I understood correctly you want to enter an entry in two lines in a cell at appropirate place hit lt+enter and again hit enter for e.g venkat (alt+enter) raman(enter) "trev" <trev@discussions.microsoft.com> wrote in message news:89B2C15C-057F-43B9-8282-37923D5EA397@microsoft.com... > I am trying to split a single cell into 2 rows can you help ...

Forcing borders of all columns when records less than max
Is there a way to force the 28 fields borders if there are less than 28 fields (28 columns is forced but borders do not show up when less than 28 records)? Can you explain what you are attempting to do? It isn't clear whether you mean 28 fields or 28 records or both. You can use the Line method to draw rectangles anywhere in your report. -- Duane Hookom Microsoft Access MVP "Michael" wrote: > Is there a way to force the 28 fields borders if there are less than 28 > fields (28 columns is forced but borders do not show up when less than 28 > records)? > ...

way to delete add. fr. auto. email add. function?
Is there a way to delete old or no longer used email addresses that appear in the drop down box when I am addressing a new email? Shebubba wrote: > Is there a way to delete old or no longer used email addresses that appear in > the drop down box when I am addressing a new email? That is the nickname cache. Search and delete the .nk2 file. That's the cache for nicknames (i.e., your manually entered e-mail addresses). If you only want to delete some of them, highlight an entry and hit the delete key. If that doesn't work, use Nirsoft's NK2 Viewer utility (it e...

POS 2009 Add-In: Populating a Task Pad
I would like to create a custom application that has the ability to maintain the items that are on certain Task Pads within POS 2009. These items would all be regular menu items (ex: hamburger, hot dog, french fries, etc) and not functions. For example, if a task pad was supposed to allow the cashier quick access to daily specials, then this custom application would need to be able to clear the task pad each day and add the items for that day. Is this going to be possible? Please provide some guidance. Thank you, Sean This is a multi-part message in MIME format. ------=_NextPart_00...

Add-in cannot be loaded OL07
Every time I open Outlook 2007 I get an error message regarding an add-in 'DCCExtensions' (DCCEXT32.DLL). It says the add-in cannot be loaded and has been disabled by Outlook. I've been getting this message ever since I uninstalled Winfax. How do I make this error stop appearing? Thanks. -- kapibarra Remove the addin from OL by using Trust Center, Addins. http://office.microsoft.com/en-us/outlook/HA100341271033.aspx#14 "kapibarra" wrote: > Every time I open Outlook 2007 I get an error > message regarding an add-in 'DCCExtensions' (DCCEXT32.DLL). ...

Format text to add character
I have two fields that should match, but one includes special characters while the other does not. Example: Field1 00ABCD123456123 Filed2 00/ABCD/123456/123/SBZ I need to find records where these two fields don't match, either by changing the display of one of them, or a query to compare Field1 character 7-15 with Field2 characters 9-14, 16-18. Hope this makes sense. Can anyone help? Thanks! Take a look at the following from the Access Help file it might be what you're looking for... Extract a part of a text value The following table lists examples of expressions that ...

Add File menu to custom toolbar
Hi All, I am trying to add the 'File" menu and "Window" menu of the Standard Toolbar to a custom toolbar but failing miserably! I think it should look something like: Sub AddMenuTitles() Application.CommandBars("MyCustomMenu").Controls.Add("File) Application.CommandBars("MyCustomMenu").Controls.Add("Window") End Sub Can anybody help please Regards Michael Sub test() AddMenuTitles True ' or false to delete End Sub Sub AddMenuTitles(bAdd As Boolean) Dim cbr As CommandBar Dim cbP As CommandBarPopup ...

add a DC in a LegSite
Hi, In the disaster recovery plan we want to create a leg site and put a DC in it. Here are some questions on how to achieve this smoothly. 1. Should I create the new site/subnet first and then promote a server in that subnet/site to DC, or should I promote a server in existing site/subnet and then move this DC to the new site/subnet? 2. When promoting a server to DC, should the server be a member server (already joined the domain) or just a workgroup member (no domain membership)? 3. The DC will be an AD-integrated DNS server. Should I install the DNS component (but not confi...

How can I add the customer's PO# to the drop-ship Purchase Order?
Our purchasing agent would like to be able to have the customers PO# from the Sales Transaction Entry screen show up on the PO's. Is this doable in Report Writer or can it not be done? We are using GP v9.0. As I still consider myself a newbie with RW, I would appreciate detailed instructions if possible. Thank you in advance for all responses. It is not possible thru traditional table relationships in Report Writer. Let me explain: you can certainly link the Purchase Order Work table to the SOP_POLink table and the SOP_POLink table to the SOP Transactions Work table, but will...

excel add-ons
Awhile back, there was an add-on for excel that had a lot more tools. It showed on the toolbar. Somehow I lost it and I would like to get it back. It had a lot of tools like for changing case and fill ins. Any help wouyld be great. Maybe ASAP Utilities. Try a 'net search for this add-in. Gord Dibben MS Excel MVP On Sun, 22 Mar 2009 20:22:43 -0400, "kmkx70a" <kmkx70a@prodigy.net> wrote: >Awhile back, there was an add-on for excel that had a lot more tools. It >showed on the toolbar. Somehow I lost it and I would like to get it back. It >had a lot of t...

Having OL automatically add a bcc: address
My boss wants to add me as a bcc: to every email she sends. Is there a way to set this up to happen automatically? Please reply to matt@lkigroup.com Thanks much. Matt ...

Map Add-On?
I am looking for an Excel Chart add on so that I can take numerical data and display it on a geographic map of states or zip codes for example. Even better I could color or shade a state based on the values in my spreadsheet. Any suggestions would be appreciated. Mark ...

VBA to page down in a subform
Hi, I have a tab control in a subform that is twice as long as the subform. When I hit a certain field in the tab control I want the subform to automatically page down so the user see's the entire botton half of the tab control contents. Is there a way to do this? Right now when I navigate through the fields fields and get to the bottom half of the tab control it only shows the field with the focus at the bottom of the form and nothing below. Thanks, Ken I think the easiest way to do this would be to set focus to a control at the bottom of the form and then move ...

How to add a VScroll to a CStatic Object
I create a CStatic object and write some text to the object but the text is too long to display in the work area but I don't konw how to add a vscroll to a CStatic object who can help me? I would say instead of a CStatic, use a CEdit control with the ReadOnly flag set. Because static controls by default aren't scrollable, so even if you add a scrollbar to it, you will have to manage the entire thing yourself (drawing, scrolling....), more trouble than it's worth. Ali R. "Smallfrogs" <super_smallfrogs@hotmail.com> wrote in message news:eLAO92y7DHA.2832@tk2msft...

Recording a marcro
Hi This is just a really simple one, to unprotect a worksheet. Having a problem. I'm going into Macros - Record - I select to save to Personal - choose as a shortcut ctrl u (for unprotect) - THEN - I go through the process of unprotecting the sheet, (even then click on a cell, just to add a final step) Then I go into Stop Recording. Well, when I click on the next sheet and hit ctrl u - I get the unprotect sheet window, that's as far as it goes. What am I doing wrong? (I go back in after this failure and delte the macro from Personal - to clear it out) ALSO - A SECOND QUESTION: ...

adding/checking records via vbcode
Hi again,I hope this is a good way of doing what i want to achieve...I have a table thats going to record all new invoice amounts and payments... it looks like this..table.IDtable.CustomerIDtable.invoiceNumbertable.recordDatetable.invoiceAmount (defaulted to 0 unless changed)table.customerPayment (defaulted to 0 unless changed)table.paymentTypeThe idea is that when producing an invoice, it records the invoice in this table and later when someone pays (even if its not the correct amount, i can record it here)..I have a button on the invoice form which normally saves the record.. I would like to...