Re: Function and Syntax problems
- From: "Carl Rapson" <mr.mxyzptlk@xxxxxxxxxxxxxxxxx>
- Date: Fri, 17 Aug 2007 16:45:27 -0500
"Confused" <Confused@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:6FAD58D4-17C9-4570-8F15-313600D57F38@xxxxxxxxxxxxxxxx
Carl,
The reason the syntax is in the format it is, because I was orginally
running this from a macro. I converted the marco to Visual and this was
the
result. I want the ID to be passed from the main form to the form opened
by
the selection in the combo box. My developers guide was stolen and I dont
currently get the proper formatting of the syntax for passing the ID. I
do
believe I have to store it before it can be passed, right? This is where
I
am stuck. I have not been do this very long so this is a new undertaking
for
me. The Me.ID is where the ID is stored? On the form's Open or Load event
would have additional syntax? Any assistance is always appreciated.
Bob
"Carl Rapson" wrote:
"Confused" <Confused@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3C3546B3-073E-4C78-BEC2-BB9517DDAA38@xxxxxxxxxxxxxxxx
I need assistance with the proper syntax for auto-filling the id field
on
one
form coming from the id field of another form. I believe the function
I
need
to use is Dlast. Here is the situation. I have several tables which
are
all
related on the ID field. In the TblIssues (My main table) the ID field
is
an
autonumber. All my tables have separate forms created. The FrmIssues
(the
main form) has a combo box which depending on the selection will open
the
appropriate accompanying form. The coding is as follows:
Private Sub Combo22_Change()
DoCmd.RunCommand acCmdSaveRecord
If (Forms!FrmIssues!Combo22 = "Ordering") Then
DoCmd.OpenForm "FrmOrder", acNormal, "", "", , acNormal
End If
If (Forms!FrmIssues!Combo22 = "Service Call") Then
DoCmd.OpenForm "FrmServiceCall", acNormal, "", "", , acNormal
End If
End Sub
What I need is when the accompanying form opens have the ID field on
the
form populate automatically with the record ID from the main form so
the
new
records will be linked.
Any help is greatly appreciated!
Why do you have 'acNormal' in the OpenArgs parameter in your OpenForm
calls?
If the main for is already positioned on the record whose ID you want,
you
could just pass the ID value in the OpenArgs parameter of OpenForm, and
then
pick it up in the next form's Open or Load event:
DoCmd.OpenForm "FrmOrder", acNormal, , , , Me.ID
Carl Rapson
If you're wanting to limit the opened form to only records corresponding to
the ID of the current record in the main form, the easiest way to do that
would be something like:
DoCmd.OpenForm "frmOrder", acNormal, , "[ID]=" & Me.ID
This assumes the field is named ID in both tables. What this will do is open
frmOrder with a record source limited to those with a matching ID value.
There's no need to store the ID value anywhere else, and there's no need to
do anything in the Open or Load event of frmOrder (ignore what I posted
before).
Carl Rapson
.
- Follow-Ups:
- Re: Function and Syntax problems
- From: Confused
- Re: Function and Syntax problems
- References:
- Re: Function and Syntax problems
- From: Carl Rapson
- Re: Function and Syntax problems
- From: Confused
- Re: Function and Syntax problems
- Prev by Date: Re: simple form calculation won't calculate
- Next by Date: Re: Set a form as a subform without the Wizard?
- Previous by thread: Re: Function and Syntax problems
- Next by thread: Re: Function and Syntax problems
- Index(es):
Relevant Pages
|