Re: Function and Syntax problems

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



"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


.



Relevant Pages

  • Re: Using excel through vbscript
    ... > Set wkbk = oxl.activeworkbook ... >> format the text file into different col. ... >> If I open file the way you told me It simply opens the text file but it does ... >>> The correct syntax would be ...
    (microsoft.public.excel.programming)
  • Re: Function and Syntax problems
    ... The reason the syntax is in the format it is, ... What I need is when the accompanying form opens have the ID field on the ... Why do you have 'acNormal' in the OpenArgs parameter in your OpenForm calls? ...
    (microsoft.public.access.forms)
  • Re: Function and Syntax problems
    ... form close when the order opens how would I go about calling the last ID ... The reason the syntax is in the format it is, ... On the form's Open or Load event ... Any assistance is always appreciated. ...
    (microsoft.public.access.forms)
  • Re: Message Alert
    ... You could try the form load event. ... So the two strSQL lines needs to be changed also: ... check a few things in your VBA editor. ... assembled strSQL by pressing Ctrl + G, which opens the Immediate ...
    (microsoft.public.access.modulesdaovba)
  • RE: Tracking Log In and Log Out times of Users
    ... Set rst = CurrentDb.OpenRecordsetin the code you gave me for the ... A Report module is the same, except it is specific to that report. ... corner and then went to properties for the form then to Load event and did ... I have a start-up form that opens when the database opens. ...
    (microsoft.public.access.modulesdaovba)