Default response in a form

L

LoriO

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
 
R

RuralGuy

Use the OpenArgs parameter to pass the value!

DoCmd.OpenForm(FormName, View, FilterName, WhereCondition, DataMode, WindowMode,
OpenArgs)

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.
 
L

LoriO

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
 
L

Larry Linson

OpenArgs is an Argument of the OpenForm method of the DoCmd object, and it
is a Property of the Form. In Access 2002 and later, it also is an Argument
of OpenReport and a Property of the Report. Open an Access module, and use
module (VBA) Help for details. It is provided for the express purpose of
passing information to a Form or Report that you open from VBA code.

Larry Linson
Microsoft Access MVP


LoriO said:
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

LoriO said:
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
 
R

RuralGuy

Here's some said:

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 ] ---

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

LoriO said:
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.
 
L

LoriO

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.


RuralGuy said:
Here's some said:

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 ] ---

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

LoriO said:
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.
 
R

RuralGuy

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.


RuralGuy said:
Here's some said:
[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.
 
L

LoriO

One last snag
strArgs = Me.ID & ";" '-- Use semicolon as a delimiter (resp1)
srtArgs = strArgs & Me.Owner & ";" (no resp)
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)



RuralGuy said:
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.


RuralGuy said:
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.
 
R

RuralGuy

You do not have Option Explicit at the top of your code module do you? It would
have caught the problem. Sorry but I did say it was <<Air Code>> :)

Answered in line!

One last snag
strArgs = Me.ID & ";" '-- Use semicolon as a delimiter (resp1)

Spelling!!! Next line:
srtArgs = strArgs & Me.Owner & ";" (no resp)
Should be:
strArgs = strArgs & Me.Owner & ";" (no resp)
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)



RuralGuy said:
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.

_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 
L

LoriO

Thank you again - you have saved me so much. I aprreciate the time you take
to answer many questions on this site - I find many very useful

RuralGuy said:
You do not have Option Explicit at the top of your code module do you? It would
have caught the problem. Sorry but I did say it was <<Air Code>> :)

Answered in line!

One last snag
strArgs = Me.ID & ";" '-- Use semicolon as a delimiter (resp1)

Spelling!!! Next line:
srtArgs = strArgs & Me.Owner & ";" (no resp)
Should be:
strArgs = strArgs & Me.Owner & ";" (no resp)
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)



RuralGuy said:
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.

_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 
R

RuralGuy

Thanks for the kind words. Glad I could help.

Thank you again - you have saved me so much. I aprreciate the time you take
to answer many questions on this site - I find many very useful

RuralGuy said:
You do not have Option Explicit at the top of your code module do you? It would
have caught the problem. Sorry but I did say it was <<Air Code>> :)

Answered in line!

One last snag
strArgs = Me.ID & ";" '-- Use semicolon as a delimiter (resp1)

Spelling!!! Next line:
srtArgs = strArgs & Me.Owner & ";" (no resp)
Should be:
strArgs = strArgs & Me.Owner & ";" (no resp)
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.

_______________________________________________
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.
 
Top