Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Create a linked field or Zoom field

Posted on 2011-02-16
11
Medium Priority
?
348 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
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

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
 

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 2000 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

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.
Desired Skill Set for Microsoft Dynamics CRM Technical Resources – Part I
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

876 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