[mso] Re: Access VB code needed

  • From: "Colli, Anthony G" <Anthony.Colli@xxxxxxx>
  • To: "'mso@xxxxxxxxxxxxx'" <mso@xxxxxxxxxxxxx>
  • Date: Fri, 3 Jan 2003 14:27:21 -0500

Leave the Checkbox after update event as is (so it opens the pop up form).
Then in the Onload event of the pop up form add: 

DoCmd.GoToRecord , , acNewRec                           'go to a new record
Me.txtCltID.SetFocus                                    'set the focus on
the form to Me.txtCltID
me.txtCltID = Forms!frmClientinfo.txtCltID      'set the value of
Me.txtCltID

This should work fine, but in using this method there are some things to be
aware of. 

Forms!frmClientinfo.txtCltID    must be open to reference it

The code above will create a new record in the pop up forms recordset. What
if this record exists already? how do you want to handle that occurrence?

-Anthony 








-----Original Message-----
From: April Pace [mailto:4office@xxxxxxxxxxxxx]
Sent: Friday, January 03, 2003 2:14 PM
To: mso@xxxxxxxxxxxxx
Subject: [mso] Re: Access VB code needed



This looks much easier!  Ok so I would put this on the onload event of the
sfrmMailingAdd form and not on the after_update procedure in the original
ClientInfo Form when I open (pop-up) the mailing form?


Look what I added to your code below:

Private Sub Check17_AfterUpdate()

    If Me.Check17.Value = True Then
                DoCmd.OpenForm "sfrmCltMailingadd"
                me.txtCltID = Forms!frmClientinfo.txtCltID
<<<<See
"sfrmCltMailingAdd"
    Else
                'do nothing
    End If

End Sub
-----Original Message-----
From: mso-bounce@xxxxxxxxxxxxx [mailto:mso-bounce@xxxxxxxxxxxxx]On
Behalf Of Colli, Anthony G
--------------------------------------------------------

Or you can have one form reference the value of a control on another form.
It usually works like this:

me.txtCltID = Forms!frmClientinfo.txtCltID

Where Forms! is the collection of forms in your database and
frmClientinfo.txtCltID refers to a control on that form. This generally
works pretty well but the form that is being referenced must be open or an
error will be raised. Use would use this from the onload event of the form
being open also.

I just happen to be doing this very same thing.

-Anthony






-----Original Message-----
From: April Pace [mailto:4office@xxxxxxxxxxxxx]
Sent: Friday, January 03, 2003 1:33 PM
To: mso@xxxxxxxxxxxxx
Subject: [mso] Re: Access VB code needed



Ok this works great and I figured out how to get it to "popup" On now the
only problem is that it is not automatically populating the txtCltID which I
assumed that it would do like if I was using a subform in the form... So
What do I need to add to this code to populate the txtCltID field from the
original form (frmClientInfo) into this form that just popped Up?


Look Below... How close am I??

-----Original Message-----
if you click the build button (...) and go into VB then some code like this
might work. Where Check17 is the name of the checkbox and
"sfrmCltMailingaddy" is the name of the form you want to open.

Private Sub Check17_AfterUpdate()

    If Me.Check17.Value = True Then
                DoCmd.OpenForm "sfrmCltMailingadd"
                '[txtCltID].Form "frmClientinfo" = [txtCltID].Form
"sfrmCltMailingAdd"
    Else
                'do nothing
    End If

End Sub

-Anthony

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx?Subject=unsubscribe

Or, visit the group's homepage and use the dropdown menu.  This will also
allow you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation
with instructions.  Once you are a member of the files group, you can go
here to upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************


*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx?Subject=unsubscribe

Or, visit the group's homepage and use the dropdown menu.  This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

Other related posts: