Send textbox value from one form to another (1 Viewer)

Bartw1

New member
Local time
Today, 06:20
Joined
Jan 10, 2019
Messages
5
I've been working this issue for several days, I've searched this forum and others and I'm sure I'm not searching on the proper keywords for a solution.

I have a form that allows the user to input a medical record number. The subform (datasheet view) then returns all admission records for that patient.

I would like to give the user the ability to select an admission record from the subform and open a form that would allow the addition of an event to that particular admission. To do this I need to be able to pass the Medical Record number originally searched and the selected Admission Record Number selected on the subform.
I've been successful in capturing the Admission Record Number but when I attempt to capture the Medical Record number I get an error stating I can not reference an object that does not have focus.

I do not have enough posts to attach my project. But if it will help, please let me know and I'll be happy to zip it and send it to be approved for posting.

I'm really just hoping that someone can point me to a thread that has covered passing values from one form to another. Not looking for someone to do the leg work, just need someone to point me in the right direction.

Thanks in advance,
Bart
 

Micron

AWF VIP
Local time
Today, 07:20
Joined
Oct 20, 2018
Messages
3,476
I can not reference an object that does not have focus.
My guess is that you are trying to get the TEXT property, which is a common error. To get a textbox control Text property requires that you first set focus to it. The default property for a textbox or combo control (and others) is .Value so all you probably need is
Forms!YourMainFormName.YourControlName. You do not need to add .Value to that, but it wouldn't be wrong, just unnecessary. Research Text vs Value to see when you'd use either.
 

Bartw1

New member
Local time
Today, 06:20
Joined
Jan 10, 2019
Messages
5
BRILLIANT! Thank you so much. This does help and gets me one step closer to what I'm trying to do!
 

Bartw1

New member
Local time
Today, 06:20
Joined
Jan 10, 2019
Messages
5
My guess is that you are trying to get the TEXT property, which is a common error.

That's exactly what I was trying to do. Thank you for letting me know. I'll try without trying to capture the .text property of the control.

Thank you
 

Bartw1

New member
Local time
Today, 06:20
Joined
Jan 10, 2019
Messages
5
Thank you again for the help. I'm able to pass the variables that I want now, however when I designed the tables I used an input mask for the fields I'm working with above. When I successfully passed the variables, the mask portion of the string did not come along. (i.e. Med Record E12345678 passed only as 12345678)
Do input masks create more problems than they solve when querying records, and passing variables? Would it be better for me to design fields w/out input masks?

Thanks again
 

June7

AWF VIP
Local time
Today, 03:20
Joined
Mar 9, 2014
Messages
5,423
I never do field formatting in table that can be done with controls on form or report. When I look at table (as developer since users never should) I want to see real data and structure. So I never set Format, Lookup, Mask, Caption in table.

Input Mask can be set to save the literal static part but often that just unnecessarily uses up storage.
 
Last edited:

Users who are viewing this thread

Top Bottom