HELP!
HELP!
(1) Customer maintenance program: once I enter the customer code, IF the code exist, I want the program to retrive the information from the customer master file, NAME, ADDRESS, etc ..., and ready for amendment instead of POPUP a selection box for customer selection. THE problem I am facing now was when I enter a customer code and press enter, it will prompt up a selection box for customer selection, no matter the customer exist or not.
Thanks and appreciate for Helps.
Thanks and appreciate for Helps.
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
HELP!
Is in customer master maintenance. When I enter customer code, if the code already exist in the customer master, I want the program jump to amendment of NAME, ADDRESS, TEL, etc, instead of POPUP a customer selection box. I want to know the command to bypass the POPUP. Thanks and appreciate for your kind attention.
asking for help and willing to help others
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
yes, i am programmer, just pick up FWH, quit confuse with DEFINE and REDEFINE, here is the source codes:-
DEFINE DIALOG oDlg RESOURCE "DebtorMaintenance"
REDEFINE GET oGetCode VAR cCode ID 110 OF oDlg Picture "@!"
REDEFINE BTNBMP oBtn1 ID 115 OF oDlg
FILENAME "c:\fwh\bitmaps\search.bmp" ACTION ( SelectCode(
oGetCode, cCode ), oGetName:VarPut( ArCust->Name ) ,;
oGetAdd1:VarPut( ArCust->Add1 ) ,;
oGetAdd2:VarPut( ArCust->Add2 ) ,;
oGetTeln:VarPut( ArCust->Teln ) ,;
oGetFaxn:VarPut( ArCust->Faxn ) ,;
oGetName:Refresh() ,;
oGetAdd1:Refresh() ,;
oGetAdd2:Refresh() ,;
oGetTeln:SetFocus() ,;
oGetFaxn:Refresh() ,;
oGetName:SetFocus() )
REDEFINE GET oGetName VAR cName ID 120 OF oDlg VALID ! Empty(
cName )
REDEFINE GET oGetAdd1 VAR cAdd1 ID 130 OF oDlg
REDEFINE GET oGetAdd2 VAR cAdd2 ID 140 OF oDlg
REDEFINE GET oGetTeln VAR cTeln ID 150 OF oDlg
REDEFINE GET oGetFaxn VAR cFaxn ID 160 OF oDlg
REDEFINE BUTTON ID ID_SAVE OF oDlg ACTION ( lSave := .T.,
oDlg:End() )
REDEFINE BUTTON ID ID_DELETE OF oDlg ACTION ( lDelete := .T.,
oDlg:End() )
REDEFINE BUTTON ID ID_CANCEL OF oDlg ACTION oDlg:End() CANCEL
ACTIVATE DIALOG oDlg CENTERED
...
Thanks and appreciate for your kind attention and help.
_________________
asking for help and willing to help others
DEFINE DIALOG oDlg RESOURCE "DebtorMaintenance"
REDEFINE GET oGetCode VAR cCode ID 110 OF oDlg Picture "@!"
REDEFINE BTNBMP oBtn1 ID 115 OF oDlg
FILENAME "c:\fwh\bitmaps\search.bmp" ACTION ( SelectCode(
oGetCode, cCode ), oGetName:VarPut( ArCust->Name ) ,;
oGetAdd1:VarPut( ArCust->Add1 ) ,;
oGetAdd2:VarPut( ArCust->Add2 ) ,;
oGetTeln:VarPut( ArCust->Teln ) ,;
oGetFaxn:VarPut( ArCust->Faxn ) ,;
oGetName:Refresh() ,;
oGetAdd1:Refresh() ,;
oGetAdd2:Refresh() ,;
oGetTeln:SetFocus() ,;
oGetFaxn:Refresh() ,;
oGetName:SetFocus() )
REDEFINE GET oGetName VAR cName ID 120 OF oDlg VALID ! Empty(
cName )
REDEFINE GET oGetAdd1 VAR cAdd1 ID 130 OF oDlg
REDEFINE GET oGetAdd2 VAR cAdd2 ID 140 OF oDlg
REDEFINE GET oGetTeln VAR cTeln ID 150 OF oDlg
REDEFINE GET oGetFaxn VAR cFaxn ID 160 OF oDlg
REDEFINE BUTTON ID ID_SAVE OF oDlg ACTION ( lSave := .T.,
oDlg:End() )
REDEFINE BUTTON ID ID_DELETE OF oDlg ACTION ( lDelete := .T.,
oDlg:End() )
REDEFINE BUTTON ID ID_CANCEL OF oDlg ACTION oDlg:End() CANCEL
ACTIVATE DIALOG oDlg CENTERED
...
Thanks and appreciate for your kind attention and help.
_________________
asking for help and willing to help others
HELP!
Here is the SelectCode() function:-
...
function SelectCode( oGetCodex, cCodex )
select 1
set softseek on
seek cCodex
set softseek off
ArCust->( DbChoice( "Select a customer", 1 ) )
oGetCodex:VarPut( AllTrim( ArCust->Code ) )
oGetCodex:Refresh() // repaints the GET
return nil
function DbChoice( cTitle, cSelect )
local oDlg, oBrw
DEFINE DIALOG oDlg RESOURCE "DbChoice" TITLE cTitle
if cSelect = 1
REDEFINE LISTBOX oBrw ;
FIELDS ArCust->Code, ArCust->Name ;
HEADERS "Code", "Name" ;
ID 100 OF oDlg
endif
ACTIVATE DIALOG oDlg CENTERED
return nil
...
Thanks and appreciate for your kind attention and help.
...
function SelectCode( oGetCodex, cCodex )
select 1
set softseek on
seek cCodex
set softseek off
ArCust->( DbChoice( "Select a customer", 1 ) )
oGetCodex:VarPut( AllTrim( ArCust->Code ) )
oGetCodex:Refresh() // repaints the GET
return nil
function DbChoice( cTitle, cSelect )
local oDlg, oBrw
DEFINE DIALOG oDlg RESOURCE "DbChoice" TITLE cTitle
if cSelect = 1
REDEFINE LISTBOX oBrw ;
FIELDS ArCust->Code, ArCust->Name ;
HEADERS "Code", "Name" ;
ID 100 OF oDlg
endif
ACTIVATE DIALOG oDlg CENTERED
return nil
...
Thanks and appreciate for your kind attention and help.
asking for help and willing to help others
NEW METHOD!
Please advise the easier and simple way of doing CUSTOMER MASTER MAINTENANCE (NEW, EDIT, DELETE, SEARCH), Thanks.
Re: HELP!
david lim wrote:Here is the SelectCode() function:-
...
function SelectCode( oGetCodex, cCodex )
select 1
* set softseek on
* seek cCodexCode: Select all
if ArCust->(DbSeek( cCodex )) if ArCust->Code==cCodex return nil end end
* set softseek off
ArCust->( DbChoice( "Select a customer", 1 ) )
oGetCodex:VarPut( AllTrim( ArCust->Code ) )
oGetCodex:Refresh() // repaints the GET
return nil
function DbChoice( cTitle, cSelect )
local oDlg, oBrw
DEFINE DIALOG oDlg RESOURCE "DbChoice" TITLE cTitle
if cSelect = 1
REDEFINE LISTBOX oBrw ;
FIELDS ArCust->Code, ArCust->Name ;
HEADERS "Code", "Name" ;
ID 100 OF oDlg
endif
ACTIVATE DIALOG oDlg CENTERED
return nil
...
Thanks and appreciate for your kind attention and help.
HELP!
Thanks & appreciate for kind attention and help.
. . .
DEFINE DIALOG oDlg RESOURCE "DebtorMaintenance"
REDEFINE GET oGetCode VAR cCode ID 110 OF oDlg Picture "@!"
REDEFINE BTNBMP oBtn1 ID 115 OF oDlg
FILENAME "c:\fwh\bitmaps\search.bmp" ACTION ( SelectCode(
oGetCode, cCode ), oGetName:VarPut( ArCust->Name ) ,;
oGetAdd1:VarPut( ArCust->Add1 ) ,;
. . .
oGetEmai:Refresh() ,;
oGetReps:Refresh() , oGetName:SetFocus() )
REDEFINE GET oGetName VAR cName ID 120 OF oDlg VALID ! Empty
( cName )
REDEFINE GET oGetAdd1 VAR cAdd1 ID 130 OF oDlg
. . .
function SelectCode( oGetCodex, cCodex )
if Empty( cCodex )
DbGoTop()
ArCust->( DbChoice( "Select a customer", 1 ) )
else
Select 1
ArCust->( DbSeek( cCodex ) )
if ArCust->Code==cCodex
return nil
else
set softseek on
seek cCodex
set softseek off
ArCust->( DbChoice( "Select a customer", 1 ) )
endif
endif
oGetCodex:VarPut( ArCust->Code )
oGetCodex:Refresh()
return nil
(1) would like to find out WHY empty customer code still valid to save?
(2) for DbChoice, to select a customer, HOW to activate an enter key instead of click on OK button for selection?
. . .
DEFINE DIALOG oDlg RESOURCE "DebtorMaintenance"
REDEFINE GET oGetCode VAR cCode ID 110 OF oDlg Picture "@!"
REDEFINE BTNBMP oBtn1 ID 115 OF oDlg
FILENAME "c:\fwh\bitmaps\search.bmp" ACTION ( SelectCode(
oGetCode, cCode ), oGetName:VarPut( ArCust->Name ) ,;
oGetAdd1:VarPut( ArCust->Add1 ) ,;
. . .
oGetEmai:Refresh() ,;
oGetReps:Refresh() , oGetName:SetFocus() )
REDEFINE GET oGetName VAR cName ID 120 OF oDlg VALID ! Empty
( cName )
REDEFINE GET oGetAdd1 VAR cAdd1 ID 130 OF oDlg
. . .
function SelectCode( oGetCodex, cCodex )
if Empty( cCodex )
DbGoTop()
ArCust->( DbChoice( "Select a customer", 1 ) )
else
Select 1
ArCust->( DbSeek( cCodex ) )
if ArCust->Code==cCodex
return nil
else
set softseek on
seek cCodex
set softseek off
ArCust->( DbChoice( "Select a customer", 1 ) )
endif
endif
oGetCodex:VarPut( ArCust->Code )
oGetCodex:Refresh()
return nil
(1) would like to find out WHY empty customer code still valid to save?
(2) for DbChoice, to select a customer, HOW to activate an enter key instead of click on OK button for selection?
Re: HELP!
Dear David,
Pls try this.
Dutch
Pls try this.
Regards,davidlim wrote:Thanks & appreciate for kind attention and help.
. . .
DEFINE DIALOG oDlg RESOURCE "DebtorMaintenance"
* REDEFINE GET oGetCode VAR cCode ID 110 OF oDlg Picture "@!"REDEFINE BTNBMP oBtn1 ID 115 OF oDlgCode: Select all
REDEFINE GET oGetCode VAR cCode ID 110 OF oDlg Picture "@!" ; VALID (if(empty(cCode),.F.,(SelectCode( oGetCode, cCode ),.T.))
FILENAME "c:\fwh\bitmaps\search.bmp" ACTION ( SelectCode(
oGetCode, cCode ), oGetName:VarPut( ArCust->Name ) ,;
oGetAdd1:VarPut( ArCust->Add1 ) ,;
. . .
oGetEmai:Refresh() ,;
oGetReps:Refresh() , oGetName:SetFocus() )
REDEFINE GET oGetName VAR cName ID 120 OF oDlg VALID ! Empty
( cName )
REDEFINE GET oGetAdd1 VAR cAdd1 ID 130 OF oDlg
. . .Code: Select all
REDEFINE BUTTON ID ID_SAVE OF oDlg WHEN !empty(cCode) ; ACTION ( lSave := .T., oDlg:End() )
function SelectCode( oGetCodex, cCodex )
if Empty( cCodex )
DbGoTop()
ArCust->( DbChoice( "Select a customer", 1 ) )
else
Select 1
ArCust->( DbSeek( cCodex ) )
if ArCust->Code==cCodex
return nil
else
set softseek on
seek cCodex
set softseek off
ArCust->( DbChoice( "Select a customer", 1 ) )
endif
endif
oGetCodex:VarPut( ArCust->Code )
oGetCodex:Refresh()
return nil
(1) would like to find out WHY empty customer code still valid to save?
(2) for DbChoice, to select a customer, HOW to activate an enter key instead of click on OK button for selection?
Dutch
THANKS
Thanks and appreciate for your kind attention and help, DUTCH.
HELP!
i got 20+ programming years (start from programmer -> analyst programmer -> systems analyst -> project manager -> software developer). program logic and data flow are totally not a problem to me, but why i still can't manage to solve this simple customer master maintenance program in gui environment! i am so sorry, but i really need helping hand from all of you. THANKS AND APPRECIATE TO ALL OF YOU.
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
David,
I have written some articles about programming in FW which may help. They are available on my website here:
http://ourworld.compuserve.com/homepage ... rogram.htm
Regards,
James
I have written some articles about programming in FW which may help. They are available on my website here:
http://ourworld.compuserve.com/homepage ... rogram.htm
Regards,
James
HELP!
i did follow what DUTCH show me,
(1) BUT when the 1st screen come out, ask for customer code, i just press enter without keying anything, the program end without saving the empty record.
(2) IF i enter any character, like A or Z, and press enter, it will simply save the record and end the program.
(3) the customer code i set to 8 characters, if i entered all the 8 characters and the focus go to next SEARCH button, it will now popup customer selection
where and what missing?
(1) BUT when the 1st screen come out, ask for customer code, i just press enter without keying anything, the program end without saving the empty record.
(2) IF i enter any character, like A or Z, and press enter, it will simply save the record and end the program.
(3) the customer code i set to 8 characters, if i entered all the 8 characters and the focus go to next SEARCH button, it will now popup customer selection
where and what missing?