Re: Form - open subform code

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I'm really sorry Marshall....I know I go too fast for everyone IRL but didn't
know I could transfer that capacity to text!!!

"Marshall Barton" wrote:

> I am not clear on what you want here. The OpenForm method
> opens the form, but you said there is something wrong.
> Unfortunately, you haven't explained what is going wrong.
> Aren't you seeing the form?

I can see the form.

You said something about it
> working if there is an existing record, is the problem that
> you don't want it to display a blank, new record ready for
> data when there is no existing record?

I don't want it to display a blank new record, I need it to open with the
existing record I am working on in another form.

Or is it that you
> want in some fields the new record to be created
> automatically?

I only said this because I thought it may help. it seems as if when there
is a value in another field already with something in it that the form will
open and be at the record I want.
>
> What are you doing to make it work when there is an existing
> record?

I go into the underlying table at the moment and put an x or a 1 or whatever
(just a character) into the Comments field.

I would think that the same things would work for a
> new record as well as on a new record, except for possibly
> setting a foreign key, but I don't see how that can be the
> problem when you can go into the table directly and enter
> data into any field to make it work. Maybe you have set the
> form's AllowAdditions property to No so it can not add any
> new records???

I will check this because I don't really know about the AllowAdditions
property.


This is the SQL code for the query that the form is based on:

SELECT tblContacts.pkCRDNumber, tblClaims.pkClaimID, tblContacts.Postcode,
tblContacts.Warehouse, tblContacts.Product, tblClaims.ReplacementOrder,
tblClaims.ReplacementReference, tblClaims.Collect,
tblReturns.KendalReturnDate, tblReturns.Comments,
tblReturns.ExpectedCollectionDate, tblReturns.PriorityCollection,
tblReturns.CollectAndReplace
FROM tblContacts INNER JOIN (tblClaims INNER JOIN tblReturns ON
tblClaims.pkClaimID = tblReturns.ClaimID) ON tblContacts.pkCRDNumber =
tblClaims.CRDNumber;

The current record exists in tblContacts and in tblClaims (joined one to
many on CRDNumber) however.....it does not yet exist in tblReturns, so I
currently create the record. Close my original form with subform
(frmFollow), go into tblReturns, enter a character somewhere, go back into
frmFollow, press my button on the subform and the correct record shows.

I want it to be able to do this but without obviously having to go into
tblReturns and enter a character.

Thank you....I really appreciate your help.

Cindy


>
> Try to slow down a little and provide the details we need to
> understand what you're trying to do along with how you've
> attempted to do it. Remember that programming is an
> extremely exacting science that requires specific details to
> do correctly.
> --
> Marsh
> MVP [MS Access]
>
>
> albycindy wrote:
> >Now...the DoCmd.Open is not to open another instance of the same form, it is
> >to open a completely different form (frmCollection) with some information
> >from a main form, some from subform (one with button) and some fields for
> >new data entry.
> >
> >I can get it to work if there is already information in frmCollection, such
> >as, if I go to the table behind it and enter a value in any field, it will
> >relate all the records and then i can open it from a form. I think I need
> >something to force a value into a field (I don't care if it's an "x" into the
> >comments field) to relate the record and then open it.
> >
> >Something like that....I think...but there is probably a better way. (and
> >you know it, don't you? Please? *please please know it*)
> >
> >
> >> albycindy wrote:
> >> >Yesterday this code was opening a form from a button on a subform but
> >> >today...oh today! It is opening a new instance of the form......I want it to
> >> >open the form with the information I entered on the subform!
> >> >
> >> >Private Sub cmdCollect_Click()
> >> >
> >> >DoCmd.Save acForm, "frmFollow"
> >> >
> >> >On Error GoTo Err_cmdCollect_Click
> >> >
> >> >DoCmd.OpenForm "frmCollections", acNormal, , "pkClaimID = " & ClaimID
> >> >
> >> >Exit_cmdCollect_Click:
> >> > Exit Sub
> >> >
> >> >Err_cmdCollect_Click:
> >> > MsgBox Err.Description
> >> > Resume Exit_cmdCollect_Click
> >> >End Sub
>
>
.



Relevant Pages

  • RE: Open a form within a subform
    ... I don't understand the 'all sub-forms run off the same query' I was ... withing the margins of the subform. ... The current form loads all the fields from each sub-form as you move ... When the form opens, it opens as a full screen document. ...
    (microsoft.public.access.forms)
  • Re: Repost - Open Form
    ... I have a table for Tech Names, a table for Jobs, and a WorkLog table brings ... subform is on is linked to the subform by job number. ... Unbound combo box "CboJobSelect" lists job numbers in db ... Form opens "fTTGeneralInfo" that lists info about job ...
    (microsoft.public.access.forms)
  • Re: The command button on my forms doesnt work, any clues why?
    ... "Subform" is a special term in Access, referring to a form that is within another form. ... When you open the main form, the subform opens in it. ... Pase the code the wizard created for you for the Click event procedure of your command button. ... my primary form to a detail form. ...
    (microsoft.public.access.forms)
  • Re: URGENT: Access Crash after System Update!
    ... I changed a subform so that it does not load until a tab ... This is happening when one form opens another form. ... The code works if I do a "system restore" to ... Windows XP SP2 Latest Patches, ...
    (microsoft.public.access.formscoding)
  • Re: Synchronize 2 combo boxes
    ... correct subform control name. ... SELECT Equipment Name From tblEquipment Details Where Category = ... but it opens adobe along with a web page that crashes the internet. ...
    (microsoft.public.access.forms)