Solved

How to have macro copy a value but not the value when the macro is recorded

Posted on 2008-10-01
6
375 Views
Last Modified: 2013-11-25
I recorded a macro which goes from the sales transaction entry window to the Items (lookup) window.  It then goes back to the sales transaction entry window, pulls up the sales customer detail entry window, clicks on the customer button, copies the customer id, hits "ok" to close the window, hits "ok" to close the sales customer detail entry window, runs a search on the customer id to return items available to that customer.

The purpose of the macro is so our sales entry team only can select items that should be available for the current customer.  The problem is the macro is using the value from when the macro was recorded (ADF-CARROLT-CAR) and not the customer id value for the current record.  Any suggestions?
# DEXVERSION=10.0.313.0 2 2
CheckActiveWin dictionary 'default'  form 'SOP_Entry' window 'SOP_Entry' 
  MoveTo field 'Lookup Button 7' 
  ClickHit field 'Lookup Button 7' 
NewActiveWin dictionary 'SmartList'  form 'IV_Item_Number_Lookup' window 'IV_Item_Number_Lookup' 
ActivateWindow dictionary 'SmartList'  form 'IV_Item_Number_Lookup' window 'IV_Item_Number_Lookup' 
ActivateWindow dictionary 'SmartList'  form 'IV_Item_Number_Lookup' window 'IV_Item_Number_Lookup' 
ActivateWindow dictionary 'SmartList'  form 'IV_Item_Number_Lookup' window 'IV_Item_Number_Lookup' 
ActivateWindow dictionary 'default'  form 'SOP_Entry' window 'SOP_Entry' 
  MoveTo field 'Expansion Button 4' 
  ClickHit field 'Expansion Button 4' 
NewActiveWin dictionary 'default'  form 'SOP_Customer_Detail_Entry' window 'SOP_Customer_Detail_Entry' 
  MoveTo field 'Customer Button' 
  ClickHit field 'Customer Button' 
NewActiveWin dictionary 'default'  form 'RM_Customer_Inquiry' window 'RM_Customer_Inquiry' 
  CommandExec form BuiLtin command cmdEditCopy 
  MoveTo field 'OK Button' 
  ClickHit field 'OK Button' 
NewActiveWin dictionary 'default'  form 'SOP_Customer_Detail_Entry' window 'SOP_Customer_Detail_Entry' 
  MoveTo field 'OK Button' 
  ClickHit field 'OK Button' 
ActivateWindow dictionary 'default'  form 'SOP_Entry' window 'SOP_Entry' 
ActivateWindow dictionary 'default'  form 'SOP_Entry' window 'SOP_Entry' 
ActivateWindow dictionary 'default'  form 'SOP_Entry' window 'SOP_Entry' 
ActivateWindow dictionary 'SmartList'  form 'IV_Item_Number_Lookup' window 'IV_Item_Number_Lookup' 
  MoveTo field 'ASI_LU_View_Button' item 1  # 'All Item Numbers' 
  ClickHit field 'ASI_LU_View_Button' item 2  # 'Customer Items' 
  MoveTo field 'PB_Advanced_Search' 
  ClickHit field 'PB_Advanced_Search' 
NewActiveWin dictionary 'SmartList'  form 'ASI_Advanced_Search' window 'ASI_Explorer_Criteria' 
  MoveTo field 'ASI_Search_Lookup_Button'[1] 
  ClickHit field 'ASI_Search_Lookup_Button'[1] 
NewActiveWin dictionary 'SmartList'  form 'ASI_Explorer_Fields' window 'ASI_Explorer_Fields' 
  MoveTo field '(L) LV_Fields' item 0  # ''
  ClickHitMS field '(L) LV_Fields' item 4  # 'Customer Number'
  SelChanged field '(L) LV_Fields' 
  DblClickHit field '(L) LV_Fields' item 4  # 'Customer Number'
NewActiveWin dictionary 'SmartList'  form 'ASI_Advanced_Search' window 'ASI_Explorer_Criteria' 
  MoveTo field 'ASI_Start_String'[1] 
  CommandExec form BuiLtin command cmdEditPaste 
  TypeTo field 'ASI_Start_String'[1] , 'ADF-CARROLT-CAR'
  MoveTo field 'OK Button K' 
  ClickHit field 'OK Button K' 
NewActiveWin dictionary 'SmartList'  form 'IV_Item_Number_Lookup' window 'IV_Item_Number_Lookup'

Open in new window

0
Comment
Question by:bradlee27514
[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
6 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 22686192
bradlee27514,

Obviously, the reference to ADF-CARROLT-CAR (Near the bottom of your snippet), needs to be "Relative"

Meaning it should be something like "CurrentRecord" or "CurrentCustomer"
something like this:
    TypeTo field 'ASI_Start_String'[1] , CurrentCustomer
How that is done in Dynamics, I am not sure.

The other option would be to store the Current Customer record as a variable, and use that.

For example:
Dim strCurrentCustomer as string
CurrentCustomer=Me.CurrentCustomer

Then in your code the line would be:

    TypeTo field 'ASI_Start_String'[1] , strCurrentCustomer

Now all of this is in "Global" terms, and is meant to give you an Idea of what needs to happen.

You can wait for another Expert (More experienced in MSDynamics Macro Recording) to chime in.

But my company uses Dynamics as well, and we have found that the technical support is superb.
Did you try giving them a call?

JeffCoachman
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 23208857
PAQed with no points refunded (of 500)

Computer101
EE Admin
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

For cloud, the “train has left the station” and in the Microsoft ERP & CRM world, that means the next generation of enterprise software from Microsoft is here: Dynamics 365 is Microsoft’s new integrated business solution that unifies CRM and ERP fun…
Desired Skill Set for Microsoft Dynamics CRM Technical Resources – Part II
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

705 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