Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flex Question-POP Manual Entry

Status
Not open for further replies.

vanessa03

Technical User
May 13, 2003
110
US
I am running Macola SQL 7.6.1a and have Flexibility although I have never used it yet. What I want to do is in the POP module, on the first Manual Entry screen, when they key in Due Date, I would like to keep the same date they keyed in until they key in another date. Right now the date that comes up is system date. Can Flex do this and if so could you give me some clue as to how. I am a newbie at VB. Thanks.
 
Although what you are asking for sounds simple, there is a lot to it. You should have some programming experience or college coursework in a computer language before you attempt it, or you might want to consider having a contractor come out for a three-day training seminar. Get in touch with your var to see if they offer training, or my company provides both programming and training if your interested. Visit viningcomputers.com if you want more info.
 
Flexibility can most certainly do this. To complete the project, what you will want to do is capture the last date entered when losing focus on the due date field. Then you just need to assign the value back to the due date field the next time you enter in a new production order. The only complication to this project is distinguishing between the user is editing an existing production order and when they are creating a new production order. I used the "Item No" field to determine what user action was occurring.

The code required to complete your project is below:
Code:
' This Windows API call will be used in conjuction with the
' constant EM_SetSel to select the text in the due date field
' after assigning the value to the field.
Private Declare Function SendMessage Lib "user32" _
    Alias "SendMessageA" _
    (ByVal hwnd As Long, _
    ByVal wMsg As Long, _
    ByVal wParam As Long, _
    lParam As Any) As Long

Private Const EM_SetSel = &HB1

' Stores the last Due Date Entered
Private sLastDueDate As String

Private Sub DueDate_GotFocus()
    ' Checks for previosly stored value and checks to make
    ' sure that the user is not editing an existing production order
    If Len(sLastDueDate) > 0 And Len(Me.Item.Text) = 0 Then
        ' Assign the stored value to the control
        DueDate.Text = sLastDueDate
        
        ' Select the text on screen, so that the user can
        ' easily type over the assigned value.
        Call SelectText(DueDate)
    End If
End Sub

Private Sub DueDate_LoseFocus(AllowLoseFocus As Boolean)
    ' Only store value if this is a new production order being entered
    If Len(Me.Item.Text) = 0 Then
        ' Store the last Due Date entered.
        sLastDueDate = DueDate.Text
    End If
End Sub

' This procedure accepts a Macola Text Box as a parameter
' and selects the text on screen.
Private Sub SelectText(ByRef ctl As macEditBox)
  Dim iStrLen As Long
  iStrLen = Len(ctl.Text)
  SendMessage ctl.hwnd, EM_SetSel, 0, iStrLen
End Sub

If you have any further questions, please feel free to ask. I would definitely suggest a training course like vbajock suggested if you plan on doing much with Flexibility. There is no formal training from Macola/Exact that you can attend but many experienced Flexibility Developers are available to give training, including myself, if your existing business partner does not have the resources.

Scott Travis
NEXO Systems, Inc.
Scott Travis
NEXO Systems, Inc.
 
Thank you both so much for your help. I definitely need a training course. Hopefully after the 1st of the year I can get some.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top