Changing of a caption?

G

Gary Dolliver

Hello again,
Ok, is it possible to have the caption of a text box to change if different
selections on controls on a previous form are selected? For example, I have
a drop down with field values 1, 2, and 3. If 1 is selected, can I have the
caption to read "1", and if 2 was selected, read "2"... and so on... I would
need the text box to be blank as it will need to collect data on the next
form.
Thoughts? Thanks!
 
R

ruralguy via AccessMonster.com

You can pass the field value in the OpenArgs argument of the OpenForm command
and then change your caption in the OnLoad event of the next form.
 
G

Gary Dolliver

Hello, sorry, I am not understanding... also, I think I need to give more
information. I am using 2 forms and 2 tables. Form1 is gathering
information that will determine what the captions are on form2. Table1 one
holds the information for form1 and is only linked to table2 via one field,
Order_ID. Table1 has fields of A, B, and C that depending on what values are
in these fields (1 through 5 in each), will determine what the captions are
for the text boxes form2.

Using the DoCmd.OpenForm, I tried putting in the arguments, however, how are
they referenced with the onLoad?

Thanks!
 
R

ruralguy via AccessMonster.com

Your 2nd form Load event will look something like:

Private Sub Form_Load()

Dim Args As Variant

If Not IsNull(Me.OpenArgs) Then
'-- Form is being opened from a form passing Label data
Args = Split(Me.OpenArgs, ";")
Me.Label1.Caption = Args(0)
End If

End Sub


Gary said:
Hello, sorry, I am not understanding... also, I think I need to give more
information. I am using 2 forms and 2 tables. Form1 is gathering
information that will determine what the captions are on form2. Table1 one
holds the information for form1 and is only linked to table2 via one field,
Order_ID. Table1 has fields of A, B, and C that depending on what values are
in these fields (1 through 5 in each), will determine what the captions are
for the text boxes form2.

Using the DoCmd.OpenForm, I tried putting in the arguments, however, how are
they referenced with the onLoad?

Thanks!
You can pass the field value in the OpenArgs argument of the OpenForm command
and then change your caption in the OnLoad event of the next form.
[quoted text clipped - 7 lines]
 
G

Gary Dolliver

Thanks! That worked great!

ruralguy via AccessMonster.com said:
Your 2nd form Load event will look something like:

Private Sub Form_Load()

Dim Args As Variant

If Not IsNull(Me.OpenArgs) Then
'-- Form is being opened from a form passing Label data
Args = Split(Me.OpenArgs, ";")
Me.Label1.Caption = Args(0)
End If

End Sub


Gary said:
Hello, sorry, I am not understanding... also, I think I need to give more
information. I am using 2 forms and 2 tables. Form1 is gathering
information that will determine what the captions are on form2. Table1 one
holds the information for form1 and is only linked to table2 via one field,
Order_ID. Table1 has fields of A, B, and C that depending on what values are
in these fields (1 through 5 in each), will determine what the captions are
for the text boxes form2.

Using the DoCmd.OpenForm, I tried putting in the arguments, however, how are
they referenced with the onLoad?

Thanks!
You can pass the field value in the OpenArgs argument of the OpenForm command
and then change your caption in the OnLoad event of the next form.
[quoted text clipped - 7 lines]
form.
Thoughts? Thanks!
 
Top