Hi,
I have a list of Codes in Item Master like;
micode &&field name
------
B1236
B1236A
B1263L
C1776
C1776A
..
..
..
When I enter B1236A, it disappear the last 'A' in the list and shows only "B1236".
Please let me know what is wrong in this?
Thanks
Code in Lostfocus event:
I have a list of Codes in Item Master like;
micode &&field name
------
B1236
B1236A
B1263L
C1776
C1776A
..
..
..
When I enter B1236A, it disappear the last 'A' in the list and shows only "B1236".
Please let me know what is wrong in this?
Thanks
Code in Lostfocus event:
Code:
If Lastkey()=13 Or Lastkey() = 9
micode = Upper(This.Value)
lenic = Len(Alltrim(micode))
If lenic = 1
micode = ''
Endif
If ! Empty(micode)
Select tIcode
Index On icode Tag icode
Seek micode In tIcode
If ! Found()
emessagetitle = 'Sales Order Entry'
emessagetext = 'Code does not exist! Would you like to search?'
ndialogtype = 4 + 16 + 256
* 4 = Yes and No buttons
* 16 = Stop sign icon
* 256 = Second button is default
nanswer = Messagebox(emessagetext, ndialogtype, emessagetitle)
Do Case
Case nanswer = 6
Do Form '\forms\FindItem'
Select icfind
This.Value = icode
micode = icode
Select tIcode
Set Order To icode
Seek micode In tIcode
This.Parent.Parent.mfull_desc.Value = full_desc
This.Parent.Parent.mbarcode.Text1.Value = barcode
This.Parent.Parent.mSize.Value = itemsize
This.Parent.Parent.mTotwt.Value = Totwt
This.Parent.Parent.mNetwt.Value = Netwt
This.Parent.Parent.mPacking.Value = Packing
This.Parent.Parent.label13.Caption = Unit
mpic = Alltrim(This.Value)+'.jpg'
This.Parent.Parent.ItemImage.Picture = '\GRAPHICS\PRODUCTS\&mpic'
If ! File("&mpic")
This.Parent.Parent.ItemImage.Picture = '\GRAPHICS\PRODUCTS\no_image.jpg'
Endif
Thisform.Refresh() && instead of setting all the Value properties let controlsources do that via refresh
Return 0
Case nanswer = 7
Nodefault
Return .F.
Endcase
Else
mpic = Alltrim(This.Value)+'.jpg'
This.Parent.Parent.ItemImage.Picture = '\GRAPHICS\PRODUCTS\&mpic'
If ! File("&mpic")
This.Parent.Parent.ItemImage.Picture = '\GRAPHICS\PRODUCTS\no_image.jpg'
Endif
This.Parent.Parent.mfull_desc.Value = full_desc
This.Parent.Parent.mbarcode.Text1.Value = barcode
This.Parent.Parent.mSize.Value = itemsize
This.Parent.Parent.mTotwt.Value = Totwt
This.Parent.Parent.mNetwt.Value = Netwt
This.Parent.Parent.mPacking.Value = Packing
This.Parent.Parent.label13.Caption = Unit
Thisform.grdcode.Left = 1045
Thisform.grdcode.Top = -195
Thisform.grdcode.Visible = .F.
Select pcrate
Locate For icode = micode
This.Parent.Parent.txtLastpricej.Value = ratemaj
This.Parent.Parent.txtLastpricen.Value = ratemin
Select GenData
Set Order To icode
Seek micode In GenData
If Found()
This.Parent.Parent.mQntyMaj.Value = QntyMaj
This.Parent.Parent.mQntyMin.Value = QntyMin
This.Parent.Parent.mRatemaj.Value = ratemaj
This.Parent.Parent.mRatemin.Value = ratemin
This.Parent.Parent.mQntyMaj.SetFocus
Endif
Endif
Else
This.Parent.Parent.mbarcode.SetFocus
Endif
Return .T.
Endif