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!

Flexibility question 1

Status
Not open for further replies.

johnCronin

Technical User
Jun 13, 2003
43
US
For reasons beyond my control, a customer has created item numbers with leading spaces. This works fine in Macola, they have been using these item numbers for years.
However, as soon as I try to reference the item number in flexibility the leading space is gone.

A very simple example demonstrates the problem.

Private Sub ItmNo_LoseFocus(AllowLoseFocus As Boolean)

ItmNo.Text = ItmNo.Text

End Sub

I the LoseFocus event is removed, the program works fine and the leading space remains.

Now I know I can work around this problem with KeyPress event and determine if the item number starts with a space but I am hoping someone has a solution and maybe an explanation.

 
I would talk them into changing the item numbers to get rid of the leading spaces. If they are using a version prior to 7.6.200, there is a tool to do a mass item number change for both P.SQL and MSSQL from Alembic Computer Services, Inc. I've used it and it works very well. The mass change program changes the part number in all fields/records for all tables in at least the Acctg, Dist and light mfg modules. I would check further on SF, MS and MRP if those are necessary to you.

My opinion would be that this would be the "better" approach since I also don't agree with having leading spaces for item numbers.

Kevin Scheeler
 
If they try to do any Internet stuff or other connectivity those spaces are going to drive them nuts. I agree with Kevin.




 
I agree with both of the messages above. However, if you just want to get a solution working with what you have you can retrieve the value using the Windows API from the ItmNo control.

Scott
 
check out Alembic Computer Services mass item number change, which you can use to change the item numbers in all tables. You are likely to find this in 50 -100 tables or more depending upon what modules you are using.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
Scott, can you post some example code using the API to get the control's value?
 
Here's the code:

Code:
Private Declare Function SendMessage Lib "user32" _
    Alias "SendMessageA" (ByVal hwnd As Long, _
                          ByVal wMsg As Long, _
                          ByVal wParam As Integer, _
                          ByVal lParam As Any) As Long
Const WM_GETTEXT = &HD
Const WM_GETTEXTLENGTH = &HE

Private Function GetFullWindowText(ByRef aControl As Object) As String
    Dim sWindowText As String
    Dim iStrLen As Long
    Dim iResult As Long
    
    ' Determine length requirements for text buffer
    iStrLen = SendMessage(aControl.hwnd, WM_GETTEXTLENGTH, 0, CLng(0)) + 1
    
    ' Create text buffer
    sWindowText = Space(iStrLen)
    
    ' Fill buffer with window text
    iResult = SendMessage(aControl.hwnd, WM_GETTEXT, ByVal iStrLen, ByVal sWindowText)
    
    ' Strip result of terminating characters and return result.
    GetFullWindowText = Left(sWindowText, iResult)
End Function

To use this just pass the name of the Macola form edit control to the GetFullWindowText procedure. In this particular thread I believe you would pass the ItemNo value, so the code would look something like this:

Code:
sItemNo = GetFullWindowText(macForm.ItemNo)

Scott
NEXO Systems, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top