strArgs = strArgs & Me.Module '-- No delimiter on the last argument (resp3)
It sends strArg(0);str(1) but the str(1) should actually be strArg(2)
(Resp1;Resp3)
So I get an error message because the openinf form is looking for
Arg(0), Arg(1) adn Arg(2)
:
Glad I could help.
Thank You!!!
I had read so much help text but none gave an example of >1 parameter. Your
help and the specific detail you gave is greatly appreciated!
PS - I take your other comments as helpful also. Since the beginning of
this database, I have learned the value of no spaces in a field name.
:
Here's some <<air code>> to give you an idea:
[In Form 1] <<<
Dim strDocName As String
Dim strLinkCriteria As String '-- In case you have a Where clause
Dim strArgs As String
strDocName = "Form 2"
strArgs = Me.ID & ";" '-- Use semicolon as a delimiter
srtArgs = strArgs & Me.Owner & ";"
strArgs = strArgs & Me.Module '-- No delimiter on the last argument
DoCmd.OpenForm strDocName, , , strLinkCriteria, , , strArgs
--- [End of Form 1 code ] ---
[In Form 2] <<<
Private Sub Form_Load()
Dim Args As Variant
If Not IsNull(Me.OpenArgs) Then
'-- Form is being opened from a form passing parameters
Args = Split(Me.OpenArgs, ";") '-- Split the Arguments into an Array
Me.ID = Args(0) '-- Zero based unless you change it
Me.[Assigned to] = Args(1)
Me.Application = Args(2)
End If
End Sub
--- [ End of Form 2 code ] ---
Now, having supplied that example I am entitled to a couple of suggestions.
Both "Module" and "Application" are Access reserved words. Using them for other
than their intended purpose will almost certainly trip up Access and cause
problems. Here's a list of reserved words:
http://support.microsoft.com/kb/q286335/
Using spaces or special characters in *any* name in Access will cause you
unexpected grief. Far better to use CamelFontNames or Under_Score_Names.
Good Luck with your project.
I can't figure out how ot use the OpenArgs
Can you give me an example or tell me where I can read up o it.
I would like to see how to 'default' the following info:
(Remembering I can do this with one form but I then have a form 3 that would
take the place of form 1 and default in the same form 2 fields)
I open Form2 from form1 with a command button
I want 3 fields on Form2 to default using fields from Form 1
1. Form2 ID = Form1 ID
2. Form2 Assigned to = Form 1 - Owner
3. Form2 Application = Form 1 Module
:
I have one form that I would like to open from a command button on another
form.
How do I default an answer to the form with out using the 1st forms name.
Form1 - Documents - I use a command button to add a new 'issue' and like
to default the ID of the main form into the 'new' form
Form2 - Enhancements - I use a command button to open the same 'issue' form
and want it to also default the ID
Ex:
If I open the form from a 'main' form the default for the field is:
=[Forms]![frm_Documents]![DTS#]
But if I use this same form and open it from another the field default is:
=[Forms]![frm_Enhancements]![DTS#]
This makes me have to have 2 separate (identical) forms just so I can
default an answer.
I know there has to be a way to do this but I can't find it
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.