InputBox? 
Author Message
 InputBox?

I have a Parent Form.  It includes 3 controls called A, B, and C.  These
each contain bits of information that vary from record to record.

I have a SubForm.  In this subform, I would like a command button so that
when the user clicks it, an inputbox will popup and the user can then enter
"A", "B" or "C" and the value of A, B or C from the parent form will be
entered into a field of the subform.

Is this making sense?  I am new to VBA and access and would really
appreciate if someone could point me in the direction of some code that
might help.

Thanks in advance



Sat, 10 Apr 2004 00:46:52 GMT  
 InputBox?
Untested air-code:

strControlName = InputBox("A, B, or C?")
Me!NameOfControl = Me.Parent.Controls(strControlName)

Wouldn't a combo box be better? If you set the Limit To List property to
'Yes', the user can only select values in the list. Using the InputBox,
you'll have to code for the possibility that the user may enter something
other than A, B, or C.

--
Brendan Reynolds


Quote:
> I have a Parent Form.  It includes 3 controls called A, B, and C.  These
> each contain bits of information that vary from record to record.

> I have a SubForm.  In this subform, I would like a command button so that
> when the user clicks it, an inputbox will popup and the user can then
enter
> "A", "B" or "C" and the value of A, B or C from the parent form will be
> entered into a field of the subform.

> Is this making sense?  I am new to VBA and access and would really
> appreciate if someone could point me in the direction of some code that
> might help.

> Thanks in advance



Sat, 10 Apr 2004 04:37:22 GMT  
 InputBox?
I don't see how I could use a combo box.  The Values in A, B and C are
different with each record of the parent.  The only combo boxes I've had
experience with are when you look up from a table.  In my instance A, B and
C are completely different fields.  At any rate; the code Brendan provided
does what I need so I thank him very much.


Quote:
> Untested air-code:

> strControlName = InputBox("A, B, or C?")
> Me!NameOfControl = Me.Parent.Controls(strControlName)

> Wouldn't a combo box be better? If you set the Limit To List property to
> 'Yes', the user can only select values in the list. Using the InputBox,
> you'll have to code for the possibility that the user may enter something
> other than A, B, or C.

> --
> Brendan Reynolds



> > I have a Parent Form.  It includes 3 controls called A, B, and C.  These
> > each contain bits of information that vary from record to record.

> > I have a SubForm.  In this subform, I would like a command button so
that
> > when the user clicks it, an inputbox will popup and the user can then
> enter
> > "A", "B" or "C" and the value of A, B or C from the parent form will be
> > entered into a field of the subform.

> > Is this making sense?  I am new to VBA and access and would really
> > appreciate if someone could point me in the direction of some code that
> > might help.

> > Thanks in advance



Sat, 10 Apr 2004 05:49:36 GMT  
 InputBox?
A combo box can also use a value list as its rowsource. The fact that the
values in A, B and C are different with each record wouldn't matter, because
the value list would contain the *names* of the controls, not the values
stored in the controls. (Although you *could* do it that way too, by
building the value list dynamically in the form's current event). Of course,
if the method you're using now works for you, that's fine. Just bear in mind
that the user can type anything at all (or nothing at all) in that InputBox.

--
Brendan Reynolds


Quote:
> I don't see how I could use a combo box.  The Values in A, B and C are
> different with each record of the parent.  The only combo boxes I've had
> experience with are when you look up from a table.  In my instance A, B
and
> C are completely different fields.  At any rate; the code Brendan provided
> does what I need so I thank him very much.



> > Untested air-code:

> > strControlName = InputBox("A, B, or C?")
> > Me!NameOfControl = Me.Parent.Controls(strControlName)

> > Wouldn't a combo box be better? If you set the Limit To List property to
> > 'Yes', the user can only select values in the list. Using the InputBox,
> > you'll have to code for the possibility that the user may enter
something
> > other than A, B, or C.

> > --
> > Brendan Reynolds



> > > I have a Parent Form.  It includes 3 controls called A, B, and C.
These
> > > each contain bits of information that vary from record to record.

> > > I have a SubForm.  In this subform, I would like a command button so
> that
> > > when the user clicks it, an inputbox will popup and the user can then
> > enter
> > > "A", "B" or "C" and the value of A, B or C from the parent form will
be
> > > entered into a field of the subform.

> > > Is this making sense?  I am new to VBA and access and would really
> > > appreciate if someone could point me in the direction of some code
that
> > > might help.

> > > Thanks in advance



Sat, 10 Apr 2004 17:28:36 GMT  
 InputBox?
Thanks to Brendan for a real education....information provided here has been
helpful and thought provoking.  I'm lucky I found this newsgroup.


Quote:
> A combo box can also use a value list as its rowsource. The fact that the
> values in A, B and C are different with each record wouldn't matter,
because
> the value list would contain the *names* of the controls, not the values
> stored in the controls. (Although you *could* do it that way too, by
> building the value list dynamically in the form's current event). Of
course,
> if the method you're using now works for you, that's fine. Just bear in
mind
> that the user can type anything at all (or nothing at all) in that
InputBox.

> --
> Brendan Reynolds



> > I don't see how I could use a combo box.  The Values in A, B and C are
> > different with each record of the parent.  The only combo boxes I've had
> > experience with are when you look up from a table.  In my instance A, B
> and
> > C are completely different fields.  At any rate; the code Brendan
provided
> > does what I need so I thank him very much.



> > > Untested air-code:

> > > strControlName = InputBox("A, B, or C?")
> > > Me!NameOfControl = Me.Parent.Controls(strControlName)

> > > Wouldn't a combo box be better? If you set the Limit To List property
to
> > > 'Yes', the user can only select values in the list. Using the
InputBox,
> > > you'll have to code for the possibility that the user may enter
> something
> > > other than A, B, or C.

> > > --
> > > Brendan Reynolds



> > > > I have a Parent Form.  It includes 3 controls called A, B, and C.
> These
> > > > each contain bits of information that vary from record to record.

> > > > I have a SubForm.  In this subform, I would like a command button so
> > that
> > > > when the user clicks it, an inputbox will popup and the user can
then
> > > enter
> > > > "A", "B" or "C" and the value of A, B or C from the parent form will
> be
> > > > entered into a field of the subform.

> > > > Is this making sense?  I am new to VBA and access and would really
> > > > appreciate if someone could point me in the direction of some code
> that
> > > > might help.

> > > > Thanks in advance



Sat, 10 Apr 2004 23:13:48 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Range from Inputbox - Please Help!

2. using a date from inputbox

3. InputBox Problem

4. Getting a date range from a month inputbox

5. Passing InputBox value

6. InputBox In Hebrow

7. InputBox

8. % in an InputBox

9. inputbox

10. InputBox Problems


 
Powered by phpBB® Forum Software © phpBB Group