Need help using MsgBox to learn Bangs & Dots

I have these things

MyDb (data base name)
tblA
tblB

Fields in tblA = Name, Location, Phone
Fields in tblB = Date, Qty, Cost

FormA with Sub_FormB

The Question: How to write code to display Cost using bangs & dots?

Assume FormA is open & displaying a record... and we double click on
something... a field or a button or whatever...

BUT we are not going to use "Me" so we can see how it all works...
maybe something kinda like??

MsgBox code MyDb ! FormA ! Sub_FormB ! [Cost]

1 - Please show me the correct way to do the above.

2 - And... how would you do it using "Me" ??

thanks for any help.

Mel

0
Mel
4/27/2007 8:38:34 PM
access 16762 articles. 3 followers. Follow

3 Replies
601 Views

Similar Articles

[PageSpeed] 51

Hi Mel

A form you currently have open can be referenced via the Forms collection:

    Forms!FormA!Sub_FormB.Form![Cost]

Note that "Sub_FormB" is the name of the *control* on FormA that contains 
the subform, which is not necessarily the same as the name of the form 
object that is contained in the control.

The actual form is reached via the Form property of the control 
(Sub_FormB.Form).

This reference will work from anywhere in your application.

If the code you are executing is in the form class module of either FormA or 
Sub_FormB, then you can get a more direct reference using "Me".  "Me" refers 
to the class object to which the module is attached (in this case a Form).

So, from FormA's module, you can use:

    Me!FormA!Sub_FormB.Form![Cost]

And, from Sub_FormB's module:

    Me![Cost]

-- 
Good Luck  :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand

"Mel" <MyEmailList@gmail.com> wrote in message 
news:1177706314.711944.304090@r35g2000prh.googlegroups.com...
>I have these things
>
> MyDb (data base name)
> tblA
> tblB
>
> Fields in tblA = Name, Location, Phone
> Fields in tblB = Date, Qty, Cost
>
> FormA with Sub_FormB
>
> The Question: How to write code to display Cost using bangs & dots?
>
> Assume FormA is open & displaying a record... and we double click on
> something... a field or a button or whatever...
>
> BUT we are not going to use "Me" so we can see how it all works...
> maybe something kinda like??
>
> MsgBox code MyDb ! FormA ! Sub_FormB ! [Cost]
>
> 1 - Please show me the correct way to do the above.
>
> 2 - And... how would you do it using "Me" ??
>
> thanks for any help.
>
> Mel
> 


0
Graham
4/27/2007 11:57:00 PM
On 27 Apr 2007 13:38:34 -0700, Mel <MyEmailList@gmail.com> wrote:

>I have these things
>
>MyDb (data base name)
>tblA
>tblB
>
>Fields in tblA = Name, Location, Phone
>Fields in tblB = Date, Qty, Cost
>
>FormA with Sub_FormB
>
>The Question: How to write code to display Cost using bangs & dots?

Why would you WANT to? If you want to display the value of Cost for a given
record in sub_FormB, put a Textbox on sub_FormB. Set that textbox's COntrol
Source property to

[Cost]

You'll see the cost.

>Assume FormA is open & displaying a record... and we double click on
>something... a field or a button or whatever...

I'm not at all sure what you are expecting here. tblA is related one to many
to tblB. You have a record on tblA. That record might correspond to zero
records in tblB, or to one record, or to three hundred and seventy-two
records, which might all have different values of Cost. 

What do you want to see!?

>BUT we are not going to use "Me" so we can see how it all works...
>maybe something kinda like??

I have NO idea what you mean here.

>MsgBox code MyDb ! FormA ! Sub_FormB ! [Cost]
>
>1 - Please show me the correct way to do the above.

Well, if you're using it in VBA code and (for some peculiar reason) want to
see the value of the currently selected record on Sub_FormB's Cost field,

MsgBox [Forms]![FormA]![Sub_FormB].Form![Cost]

>2 - And... how would you do it using "Me" ??

If the Code exists on FormA:

MsgBox Me![Sub_FormB].Form![Cost]

If the Code exists on FormB:

MsgBox Me![Cost]

Translation:

Me! is a shortcut for [Forms]![TheFormContainingTheCode]. You can use Me! in
code embedded in a form to reference that form; or you can use
[Forms]![NameOfAForm] to reference any open form in the database (including
the current form).

A Form has Objects on it. You can reference those objects by specifying the
form - using either Me! or [Forms]![NameOfSomeForm] - followed by a bang
(meaning "an object in this collection") followed by the name of the object.
The square brackets are optional unless the object name contains a blank or
special character, but square brackets are *always* allowed and *never* hurt.

A Subform control has a Form property meaning "the form contained within this
subform control"; the .Form![Cost] syntax uses . to specify that you're
looking at a Property (rather than an object) of this control; in particular
you're looking at the Form property. Once you've specified that you're looking
at a Form you can then use ![controlname] to examine that control.

Hope this helps with what is admittedly very confusing syntax!

>thanks for any help.
>
>Mel

             John W. Vinson [MVP]
0
John
4/28/2007 12:06:11 AM
Assuming that your subform control is called Sub_formB,
and that your button is on FormA:

MsgBox  me.Sub_FormB.form!Cost

Each subform sits inside a subform control. It doesn't
matter what the name of the subform is (it is just .form).

What matters is the name of the control on FormA

(david)

"Mel" <MyEmailList@gmail.com> wrote in message
news:1177706314.711944.304090@r35g2000prh.googlegroups.com...
> I have these things
>
> MyDb (data base name)
> tblA
> tblB
>
> Fields in tblA = Name, Location, Phone
> Fields in tblB = Date, Qty, Cost
>
> FormA with Sub_FormB
>
> The Question: How to write code to display Cost using bangs & dots?
>
> Assume FormA is open & displaying a record... and we double click on
> something... a field or a button or whatever...
>
> BUT we are not going to use "Me" so we can see how it all works...
> maybe something kinda like??
>
> MsgBox code MyDb ! FormA ! Sub_FormB ! [Cost]
>
> 1 - Please show me the correct way to do the above.
>
> 2 - And... how would you do it using "Me" ??
>
> thanks for any help.
>
> Mel
>


0
david
4/28/2007 12:08:39 AM
Reply:

Similar Artilces:

office 2000 [excel] cannot open previously OK file. Help
When trying to open a Microsoft Excel Work Sheet that I had accessed modified and saved to only yesterday [Office 2000] a window pops up with: "name.xls cannot be accessed. The file may be resd-only, or you may be trying toaccess a read only location. Or, the server the document is stored on may not be responding." Older files stored on the same mediums ;HD, Flash memory or 3.5in. diskette are accessed with no problem. This is on a network drive? ...

Excel and some disappeared sheets
Anybody has the same or similar experiences : - I worked with excel file / closed as usually - new day opened and unfortunatelly some very important sheets disappeared / why ? Don=B4t know - I had about 7-9 sheets just now only 3 ones are there but not so important as another ones - the file has original size / I quickly looked into file by normal text editor only for reading and all relevant data are there, however if I open file by Excel, NO original sheets or data are there. - this file is VERY IMPORTANT for me - why happened ? Don=B4t know since I ask anybody for help Thanks in advan...

Can SUMPRODUCT be used for entire column?
This formula results in a numeric result: =SUMPRODUCT((A1:A20)*(B1:B20="b")) but this formula results in a #NUM! result: =SUMPRODUCT((A:A)*(B:B="b")) Which means I need to specify the length of the columns, which may grow over time. Any way to do this for the entire column, without having to specify the length of the column? XL07 removed the limitation on array formulas (which SUMPRODUCT is, even though it doesn't require CTRL-SHIFT-ENTER) and entire columns. For pre-XL07, one can use =SUMPRODUCT(A1:A65535, --(B1:B65536="b")) to get all but on...

crm consultant needed asap
i am looking for a crm consultant who has a lot of experience with form customization, crm implimentation, heavy work flow, and activities. ideally someone in arizona but not required. telecommute will be considered for the right person. looking for someone for a possible 2 month (i am guessing here....) project. if you are available and have this experience please email me at j-e-f-f@mag-en-ta-tech.c-o-m (remove the -). we are looking for someone to start like next week at the latest (this message was posted 08-08-2004). This message was posted 8/4, not 8/8. And I have some swamp land in f...

Using scanner in Word97
I want to scan a picture into word97 using my HP 4370 ScanJet. Could not find option of "From Scanner" under "Insert" --> "Picture". Apparently I must need some sort of Word97 Add-On. What and where is the add-on? Is it on the Office97 CD? Same applys to Excel97. Also, does microsoft sponsor a Word97 / Office97 discussion group? If so, would appreciate a link. "PSRumbagh" <PSRumbagh@discussions.microsoft.com> said this in news item news:39100DC1-A7EE-4679-881D-526BAA386620@microsoft.com... > I want to scan a picture ...

Using later version of microsoft access
Hi, I've got access 2000 on my computer. When I go to open a database someone sent me I get an error message : this database is in an unrecognized format. The database may have been created with a later version of microsoft access. Is there any way I can open and use this file (short of upgrading to later version of access)? If you do not have Access 2002 or 2003, ask the person to save it in Access 2000 format for you. -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at m...

OL2002 Problem : HELP, SOS, MAYDAY
Hi, I have an IMAP account and OL2002 as client. I have checked for my account ( tools, send/receive settings, define send/receive groups, <my_account>, edit) download item description only. It works only the first time I start OL2002, but it does not work anymore for subsequent automatic/manual send/receive operations. Please could someone really help me ? Thank you in advance, Patrick ...

Using Company Wide Mail Templates.
Hi, I do not know if i am at the right spot here, or if it is evne possible, but i got the following question. My boss would like me to make sure that every outgoing mail has the same looks. It starts by adding a signature that is the same for everyone, except with ofcourse personalized information. This was easily done by giving everyone a signature. The next question is however, to put the head of our website, also above our mail. This means that every user that sends a mail, the mail will have a nice header, underneath that header, the mail is typed, and then its ended with the si...

Dynamic Range Selection Using VBA
What I'm trying to accomplish is to be able to run a procedure that selects a range based on a number provided in another cell. For example; if the number 10 is in cell A1, then cells A20:A30 would be selected when I run the macro. If the number 6 is provided, then cells A20:A26 would be selected. Not sure where to start, so any help is appreciated. this may do what you want range("A20").Resize(range("A1").Value+1).select -- Gary Keramidas Excel 2003 "TEK" <TEK@discussions.microsoft.com> wrote in message news:DA9FFF99-FC28-...

how create Quota filter in WIndows 2003 R2 using Script
Hi all I need create quota filter in Server 2003 R2 using vbscript. quota filter should be applied to directories and not by users. I searched information about it on google without success. thank's in advance Daniel Hi Daniel. First you need open your FSRM (File Server Resource Manager), then you create a quota template, you must specify if your quota is "software" (just monitoring, but never deny the user) or "hardaware" (deny users when they use 100% of the quota), you must specify if you want send e-mail to user when this user use...

Help With Margin Formula
Hello, I need help with a margin forumla (calculated from retail). Say I have a cost of $10.00, and I need the formula to calculate a 40% margin from retail. So the retail should end up at $16.67. Not sure how to get from $10.00 to $16.66, I just know the cost and the margin I need to make. Thanks JR =A1/(100%-40%) -- Kind regards, Niek Otten "JR" <gaspower@aol.com> wrote in message news:eGszf.424$2O6.53@newssvr12.news.prodigy.com... > Hello, > I need help with a margin forumla (calculated from retail). Say I have a > cost of $10.00, and I need the formul...

GETPIVOTDATA data_field help
When I enter a reference to a cell, eg A2, as the value for the data_field item in the GETPIVOTDATA I get a #REF error. However, when I instead type the value of A2, eg 2003, manually into the GETPIVOTDATA formula, it works. Can anyone please help--I want this formula to vary based on what is in A2. Cheers This function is so variable in action, and difficult to handle, that have given it up in favour of VLOOKUP. In fact, having no problem i use with pivot tables -- Message posted from http://www.ExcelForum.com Try copying the headings from the pivot table, and pasting them into the ce...

Exchange server crashed, please help....! Need to restore two priv.edb and pub.edb files into one....!
Hi Guys, I was wondering if I could get some help with the following problem we are having on our company. Here is the scenario; Our Windows NT 4.0 SP4a server running Exchange 5.5 SP4 crashed (Server 1) due to the exchange database reaching its 16 Gig's max limit. I went ahead and moved some mailboxes' e-mails to a few .pst files in order to make some space. This worked ok. Then, I decided to build another exchange server (Server 2) to moved some mailboxes and alleviate the load. Once the server was ready and configured as part of the current exchange site, I went ahead and move...

Help!!!!
I am running Exchange 5.5 on NT 4.0 sp6a. Norton Anti- virus deleted my edb.log file. I have done an on-line restore with Arcserve 2000 and now my directory service won't start. getting 1166 internal processing error. I have been to support and could find anything that helped. Thanks in advance You may want to run eseutil /mh <drive and path to your dir.edb and include the dir.edb > c:\edb.dmp. Find this file and see if your dir is also inconsistent. If so you will need to restore your dir. -- Nan Bennett (MSFT) Microsoft Exchange Support Please do not send e-mail...

Using Publisher 200 with Publisher 2003
How do I covert PUB2000 documents to Pub2003 documents and vice versa? Pub 2003 can open anything, no conversion necessary. Going backward is a bit trickier. File - Save As and chance the file type to a Pub 2000 file. Possible problems can arise if you've used a feature that was not available in the 2000 version and your file size will grew immensely. -- JoAnn Paules MVP Microsoft [Publisher] "nasuco" <nasuco@discussions.microsoft.com> wrote in message news:500C7A7A-4026-434C-8CC2-2DFDB69D81C4@microsoft.com... > How do I covert PUB2000 documents to Pub2003 do...

Removing text from cells leaving numbers (help with function)
I need a function that will remove all text from a cell and just leav numbers. Formatting cells to number does not work. For example if I have: (Sired] Tennessee 37013 (herein I just want 37013 left. Anybody know a function to resolve this -- Message posted from http://www.ExcelForum.com The following will strip the text from the active cell and place the number in the adjcent cell one column to the left. If there are subsequent numbers in the original string you will get erroneous results. Put the cursor on the cell to be processed and run the macro. ********************************...

I really need help with a formview problem
I have a formview that I place a toolbar onto. In my OnInitialUpdate(), after I create the toolbar, I say GetParentFrame()->RecalcLayout(); ResizeParentToFit(FALSE); ResizeParentToFit(TRUE); The formview is still not sized properly. It looks like the problem is the toolbar on the top of the formview. It is not being taken into account in sizing the formview. The difference at the bottom of the form that is not displayed is the size of the toolbar. Any suggestions? Should work if your toolbar was created (and docked) back in your CMainFrame::OnCreate() method. ----- William Gower ...

Bank One Download is not working
We are trying to download transaction data directly from Bank One and the file is not being recognized by Money - i.e. the Bank One website states that the download is complete, but Money does not recognize it. Note that a file is being saved on our hard drive but we can't figure out how to read it. It is entitled mnyimprt.exe-(numerous numbers and letters follow). In microsoft.public.money, Miki wrote: >We are trying to download transaction data directly from >Bank One and the file is not being recognized by Money - >i.e. the Bank One website states that the downloa...

help #2
Hi, I need help with the following: I need to plot a 2-D column graph comparing the profit margin (y-axis) for the 3 items (x-axis) for Malaysia and Singapore, using the data below; Malaysia Item Mfr's Agent's Retailer's Selling GST Profit Total Cost Charge Markup Price Margin Lipstick 9.85 15.76 12.81 38.42 1.54 27.03 105.40 Toner 11.90 19.04 15.47 46.41 1.86 32.65 127.33 Cleanser 15.90 25.44 20.67 62.01 2.48 43.63 170.13 Total 37.65 60.24 48.95 146.84 5.87 103.31 402.86 Singapore Item Mfr's Agent's Retailer's Selling GST...

problem opening up program/file
Hello, All. I am having some trouble opening up Word. It was working okay until I loaded some fonts to FontBook. Okay, now I removed all my fonts but I still get this error message about corrupt fonts I have on my computer. When I open Word, I see the blue starting-up window: Word:Mac 2004. Right underneath the product ID #, I see that it is initiating... when it gets to the point "Optimizing font menu performance" I start getting this error windows popping up one after another. (E.g. The font M TimesSmallText is corrupt and should be removed.) I keep on clicking okay for a whole lot...

How to use different return email addresses
I use outlook 98. I have a mailbox with three aliases. People sending me emails can use any of the three email aliases and the email will arrive in the same mailbox. Accessing the mailbox once will retrieve all messages regardless of which alias was used. If I reply to these emails though, I want the recipient to think that the email has come from the alias that they originally used. What outlook always seems to do is use the email address of the service that is listed first in Tools->Services->Delivery. Is there any way Outlook can be set up so when I reply to a given email, my email ...

Credit Card Downloading HELP!
I had 2005 and this worked ok but not on 2006. I download my 20 credit card transactions in QIF format. Money says it has 20 to review so I click that and they simply do not appear in the register! The the heck?!? I've tried quite a few things already to no avail. Deleted history and temp, deleted the statement and previous transactions/statements, repaired my money file a few times, tried to import in a different file but it just doesn't show up. Suggestions please...tia In microsoft.public.money, lucas.allen@gmail.com wrote: >I had 2005 and this worked ok but not on 2006....

Errror Help: character ' ', hexadecimal value 0x2 is illegal in xml documents
what does this error mean? how can i fix this? thanks, raj * raj wrote in microsoft.public.dotnet.xml: >what does this error mean? how can i fix this? You have an octet 0x02 or perhaps a character reference &#x02; in the document. This is not allowed in XML 1.0; the latter is allowed in XML 1.1 but your version of the .NET framework probably does not support that, and most likely you have not declared this version either. In other words, your document includes random binary data and is there- fore not an XML document. You have to correct the document before you can successfully...

mail gateway help
we have barracuda for our mail firewall but you can send mail out through it. Where do you normally point your exchange server to send mail out? the internet router the pix firewall ? "=?Utf-8?B?RWRkaWU=?=" <Eddie@discussions.microsoft.com> wrote in news:EF923D10-571B-42D0-85E3-D45CB9FC2A1C@microsoft.com: > we have barracuda for our mail firewall but you can send mail out > through it. Where do you normally point your exchange server to send > mail out? the internet router the pix firewall ? > What exactly is your question? What version of exchange are you us...

Where is "Help" located in 2007?
I cannot find the "Help" section in Word 2007. Where can I find it? Thank you! Click the question mark ? top right of the Word window or press F1 which is the universal help call. -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<> "Todd" <Todd@discussion...