Solved

Create a linked field or Zoom field

Posted on 2011-02-16
11
340 Views
Last Modified: 2012-05-11
I have a field in RMA Entry Update window that display the related Work Order or RTV Number I would like to be able to click on this field and open the proper work order or RTV .
how can I accomplish that ?
Thanks
0
Comment
Question by:taverny
  • 7
  • 4
11 Comments
 
LVL 10

Expert Comment

by:Abdulmalek_Hamsho
ID: 34911863
In Modifier, create a button under the label of the RTV/WO #, add it to VBA, then hide it. For the label to look blue and underlined (like a link), select the label and set the property Zoom to True.
Add your code to the Button_Changed() event to open the respective transaction.
0
 

Author Comment

by:taverny
ID: 34912219
ok I was able to create a button and hide it. but I am confuse is how to tell the button depending of the data that inside my field to open the correct form and pass the field info . I would like to do somehting like that :
if the field has a WO#  then call WorkOrderEntryupdate window with This WO #.
else if it is a RTV # call the RTV window with RTV #
else if empty or not matching RTV or WO  don't do anything.
0
 

Author Comment

by:taverny
ID: 34912264
ok here is an update and approach I got and seems to work but how I do pass the WO# from my current window.

    If Left(StrWORTVNum.Value, 3) = "WRK" Then
    WorkOrderEntryUpdate.Open

    End If
0
 

Author Comment

by:taverny
ID: 34912338
Well I think I got it. can you please tell me if this code is good enough? or I should be carrefull with something?
thank you

Private Sub ButWoRTVLookup_Changed()

    If Left(StrWORTVNum.Value, 3) = "WRK" Then
        WorkOrderEntryUpdate.Open
        WorkOrderEntryUpdate.WorkOrderNumber = StrWORTVNum.Value
    End If  
    If Left(StrWORTVNum.Value, 3) = "RTV" Then
        RTVEntryUpdate.Open
        RTVEntryUpdate.RTVNumber = StrWORTVNum.Value
    End If
   
End Sub
0
 
LVL 10

Expert Comment

by:Abdulmalek_Hamsho
ID: 34912427
Your code is not bad, but I prefer searching for the StrWORTVNum in the RTV table, if it's not existed then search for it in the WorkOrder table and respond accordingly.

I'm suggesting to search in the WorkOrder table after searching in the RTV table for your code concistency, but you can do something like this:

' Search RTV table
If found in RTV table then
   RTVEntryUpdate.Open
   RTVEntryUpdate.RTVNumber = StrWORTVNum.Value
Else
   WorkOrderEntryUpdate.Open
   WorkOrderEntryUpdate.WorkOrderNumber = StrWORTVNum.Value
End If
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:taverny
ID: 34917446
I think you are right , your approach seems better but since the field is populated if the record exists in either of the table then I should be safe to go directly with the field opening the RTV or WO if the field is not empty.
0
 
LVL 10

Accepted Solution

by:
Abdulmalek_Hamsho earned 500 total points
ID: 34917570
In this case, you can but a flag (Boolean IsRTV) and set it to true if you found the record in RTV table, otherwise, IsRTV = False if found in WO table. And do this:

If IsRTV then
   RTVEntryUpdate.Open
   RTVEntryUpdate.RTVNumber = StrWORTVNum.Value
Else
   WorkOrderEntryUpdate.Open
   WorkOrderEntryUpdate.WorkOrderNumber = StrWORTVNum.Value
End If

The purpose is not to issue two SQL statement to the server, one to decide what's the RTV/WO #, and the next to make sure it's existed.

Your  Left(StrWORTVNum.Value, 3) = "WRK" command is not generic, because it won't work if the Trx Prefix was WO even if you can ensure that your Trx prefix is 3 chars long and either starts with WRK or RTV.
0
 

Author Comment

by:taverny
ID: 34917820
I am sorry I lost you there.

Everytime that my window loads for an RMA line it looks in the table to pull the SVC_Document_Number (which is my RTV/WO #) and put it in the strWORRTVNum field of my screen( just to be clear , the strWORRTVNum is a field on my RMA and not on my table) .and my user can't modify anyway. so either it has an RTV000000 or WO000000 or just empty but can't be anything else.
so if I do a test on the field to be RTV or WRK then I should be safe , anything else would be that it doesn't exists. and those prefix are always gonna be RTV or WRK

am I missing something?
0
 
LVL 10

Expert Comment

by:Abdulmalek_Hamsho
ID: 34918103
I know, but in future, your company many change the prefix of the trx, in this case you would need to alter your code. I always recommend being generic in your code.
0
 

Author Comment

by:taverny
ID: 34918369
I understand , well I know it would be poor programming , I guess I will leave it like that for now and modify it in the future since I really doubt we will ever change it .
but thank you for your concerns
0
 

Author Comment

by:taverny
ID: 34928683
Hi,
 Just wanted to let you know I just open a new question that I think you are the most familiar with my code.
Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

On Sep 22nd 2014 Microsoft released Update Rollup 1 for Microsoft Dynamics CRM 2013 Service Pack 1 and back in July Update Rollup 3 was released.  So we now have:   Update Rollup 1Update Rollup 2Update Rollup 3Service Pack 1Update Rollup 1 for S…
Automatically creating a Trello card using data from a Microsoft Dynamics CRM record turned out to be an easy project that yielded great results.  Here's how I did this for an internal team at General Code.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

910 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now