Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User Created Input Box

Status
Not open for further replies.

LarryDeLaruelle

Technical User
May 19, 2000
1,055
US
I am setting up a Workmens' Compensation database for our HR department. I will use a main form that basically will have a combo box to select the staff name and a subform using continuous form format that will display all reported injuries and allow for entry of new reports.

Because of the number of fields I can't allow much length for description (text) fields. What I would like to do is use a double click event on these fields to pop open a small form with a single unbound text control, feed the control the existing contents of the calling field and allow the user to edit and/or add information.

I'm fine up to this point. The double click event opens the form with the current information displayed.

My question is, after the information has been edited/added, how do I pass that information back to the field which generated the double click event? (I'll have three such fields on the form.)

Thanks.
Larry De Laruelle
larry1de@yahoo.com

 
how about putting something like this on the close event of the pop up, or on the click event of the close button, if you have a close button on the pop-up form

Forms!MainFormName!SubFormName!TextBoxName = the value from the popup box

To get the syntax of the subform control correct, I always use the Expression Builder, so I can't guarantee that the above syntax is correct.

Does this do what you want? Kathryn


 
Kathryn:

Thanks for the reply. I think you are right that this is what I need.

But, since I will be calling the form from at least three separate text boxes I can't hardcode the form and field name in the close event.

I guess what I need is advice on how to pass both a field value and a field name to the input form. Any suggestions?

Thanks.
Larry De Laruelle
larry1de@yahoo.com

 
Yes! there is a really cool option for forms called OpenArgs. It allows you to pass parameters to a form. Check out "OpenForm Method" and look at the last parameter passed.

You access the arguments by accessing the OpenArgs property of the form.

Let me know how it goes. Good luck. Kathryn


 
Kathryn:

That's what I have been tinkering with. I am passing both the value and the Forms!frmName.txtName separated by a semicolon. It looks like this:

Diagnosis & ";Forms!frmInjury!frmInjurySub.Diagnosis"

In the On Load event I parse out the value using a Left$.

In the close On Click event I parse out the Forms! etc string. That is where I am hung up now. I figure that I need to dim a control for this value which I did as:

Dim ctlCallingForm as Control

However, when I try to assign a value to it from the OpenArgs it drops through and ctlCallingForm is equal to nothing.

ctlCallingForm = Right$(OpenArgs, intSemi + 1)

Where intSemi is an integer value I used to capture the position of the separating semicolon.

I'm familiar with the OpenArgs but I've never tried to pass more than one value nor have I tried to pass a control.

Am I on the right track or am I missing something?

Appreciate the help.


Larry De Laruelle
larry1de@yahoo.com

 
A couple of things:

Are all your fields going to start with Forms!frmInjury!frmInjurySub....? If so, you don't need it to be passed. Just pass the name of the textbox.

Then you can refer to the textbox using some funky syntax. Assume that you have parsed out the textbox name and assigned it to a variable named txtName:

Forms!frmInjury!frmInjurySub(txtName) I am not one hundred percent sure that this will work but search around in the help files and you will find a reference to referring to controls using variables for the control name.

Also:

Right$(OpenArgs, intSemi + 1)

This will return the rightmost number of characters equal to intSemi + 1. I think you want the Mid function. Look at the help files on Mid and see if you agree.

Gotta go, the weekend is calling!

Kathryn


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top