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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please help with List Box

Status
Not open for further replies.

PBREP

MIS
Mar 14, 2003
75
US
Hello All:
I need to have a list box appear, user selects a service type (i.e. G, GR, 2D, etc...). I have a table called 'Custcode.dbf' that has the service types entered in a field called 'code'. I need to pull all from custcode.code and when the user double-clicks their service type, it will be inserted into the Logdetl.logacttv (logacttv is where I need the service type code inserted).

Using VFP 5.0 in a Windows 2000 enviroment.

Thank you all & Happy Holidays,
~PM

&&MyCode
Procedure ServiceType()
back_to=SELECT() && curretn work area

oForm = createobject('ServiceType')
oForm.Show

Define class ServiceType as Form
DataSession = 2 && Private data session
Caption='Select custcode' && This is where you list their && service type, utilizing it like a temp table(prevent
&& table lock).

ControlBox= .f. && We don't want ,min,max etc buttons
BorderStyle=1
Height=300
Width=200
*Autocenter=.T.
WindowType=1 && Modal - we don't want user to go on into this
Add object ServiceType as listbox with ;
Left=0, Top=0,Height=300,Width=200

Procedure ServiceType.Init
list.value=lstCode.code

USE Custcode in 0 again alias mcode

With this
.RowSourceType = 3 && SQL

.RowSource = 'select logacttv from mcode into cursor lstCode'
.Columncount=1
Endwith

Endproc

Procedure ServiceType.dblclick

insert into LOGDETL (Logacttv) values (this.value)
select mLogdetl
USE

IF USED(back_to) && do we have some where to go back to
SELECT (back_to)
ENDIF

Thisform.release()

Endproc
Enddefine
 
PBREP

Can you please explain where the problem is?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Sorry Mike, good question..LOL

First error I get during runtime is:

"Object 'List' not found"

Thanks,
~PM

Procedure ServiceType()
back_to=SELECT() && curretn work area

oForm = createobject('ServiceType')
oForm.Show

Define class ServiceType as Form
DataSession = 2 && Private data session
Caption='Select Service Type'
ControlBox= .f. && We don't want ,min,max etc buttons
BorderStyle=1
Height=300
Width=200
*Autocenter=.T.
WindowType=1 && Modal - we don't want user to go on into this
Add object ServiceType as listbox with ;
Left=0, Top=0,Height=300,Width=200

Procedure ServiceType.Init
list.value=lstCode.code

USE Custcode in 0 again alias mLogdetl

With this
.RowSourceType = 3 && SQL

.RowSource = 'select code from custcode into cursor lstCode'
.Columncount=1
Endwith

Endproc

Procedure ServiceType.dblclick

insert into LOGDETL (Logacttv) values (this.value)
select mLogdetl

IF USED(back_to) && do we have some where to go back to
SELECT (back_to)
ENDIF

Thisform.release()

Endproc
Enddefine
 
Another problem (Syntax):

I want to insert the service type (ref. seleted by user)that is located in the same record that'UPSRES' (located in the 'logcode' field)is in (ref. Logdetl.dbf).

Procedure ServiceType.dblclick

insert into LOGDETL (Logacttv) values (this.value)
select mLogdetl;
Where Logcode = 'UPSRES'&& Compile error

IF USED(back_to) && do we have some where to go back to
SELECT (back_to)
ENDIF
 
PBREP

select mLogdetl;
Where Logcode = 'UPSRES'&& Compile error


It sounds like you have resolved your problem, but for the benefit of other members, a SQL statement need a table reference in it as in :


select mLogdetl;
from myTable Where Logcode = 'UPSRES'



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top