Solved

How set value of textbox on form with a macro?

Posted on 2014-01-03
7
9,589 Views
Last Modified: 2014-01-12
I have a temp value "TempLocID" and would like to set the value of a text box [LocID] in a form that is already open and on the correct record.  I need to set this value with a macro.  How do I do this?  Assume that the macro is already running, has just set the temp value, and put the focus onto the previously mentioned form and record.
0
Comment
Question by:BD
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 22

Expert Comment

by:rspahitz
ID: 39754958
Have your tried this somewhere in the macro:

[LocId].Value = TempLocID

Open in new window


?

With ".Value" you don't need to set the focus.
0
 

Author Comment

by:BD
ID: 39755124
No clue where to put that.  What macro action should I be using?
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 39755519
It depends on when you want this to happen.  Basically you need to identify a" trigger" for this action, such as "when someone changes text in a text box (TextChanged event) or when the form is about to be saved (BeforeSave event) or when the use leaves a field (Leave event) or maybe when the record is first loaded (Current event).

e.g. on the Form object, in the properties' Events tab, double-click "On Current" and then click the [...] button to get to the code window and enter the above code.
0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

Author Comment

by:BD
ID: 39756148
The trigger will already have occurred.  Review the last sentence in my original post: "Assume that the macro is already running, has just set the temp value, and put the focus onto the previously mentioned form and record".  

So I have a good handle on how to trigger the event as the macro will already be running.  Where I am lost is understanding what additional actions I need to add to the currently running macro in order to set the value of the [LocID] text box with my temp value.
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 39756428
Ah, I see the problem.  You create a "new macro".  Perviously Microsoft called VBA code macros.  With VBA macros, the above code works perfectly by simply inserting it into any appropriate sub.

If you don't want to migrate everything to VBA, then add the following:

Action = "SetProperty"
Control Name = LocID
Value = TempLocID

I haven't worked much with these macros in a long time, so see if the above works.  If not, attach the spreadsheet (minus any proprietary data) and I'll see what I can do.
0
 

Accepted Solution

by:
BD earned 0 total points
ID: 39762394
I have discovered the very macro action that accomplishes what I need to do!

It would appear, when using macros, that there is indeed a "SetValue" action, but MS Access hides it by default not allowing users to utilize this "Unsafe Action".  On the Design tab under the Show/Hide section there is a "Show All Actions" toggle button.  When active, users can see a whole new world of macro actions available to them.

Stupid, just stupid...

Thanks rspahitz for your assistance.
0
 

Author Closing Comment

by:BD
ID: 39774452
No other comment answered my original question, though rspahitz was helpful and eager.
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question