I am posting some code that perhaps someone out there can help me with.
I have a parent/child database that handles inventory labels. When these labels are purchased they need to be added to the inventory and then used later on.
I want the user to select a record in the parent, then use the following script on a button which will add the records to the child database.
The script is as follows (sorry for the jumble):
'Date Created: 27-Dec-2002 06:16:20 PM
'Last Updated: 28-Dec-2002 01:12:31 AM
'Created By :
'Updated By :
'Displays a message box (style:'OK Button', image: 'Attention symbol', id: 'Msg1').
DIM SHARED Msg1_result as N
DIM SHARED Msg1_OK_Button as L
Msg1_OK_Button = .F.
title_var = "Enter new Asset Labels"
message_text_var = vartags+\" additional labels to this main category of the database. Is this correct?\"")
Msg3_result=ui_msg_box(title_var,message_text_var,UI_OK_CANCEL+ UI_FIRST_BUTTON_DEFAULT+ UI_INFORMATION_SYMBOL)
'Test to see which button on the message box was pressed....
SELECT
CASE Msg3_result = UI_OK_SELECTED
Msg3_OK_Button= .t.
CASE Msg3_result = UI_CANCEL_SELECTED
Msg3_CANCEL_Button= .t.
END SELECT
dim lastrec as c
t=table.current(1)
c=table.current(2)
vartest=t.mainno
'vartest.refresh()
c.fetch_last()
if msg3_ok_button = .t. then
lastrec=c.subno
dim counter as n
'dim subcount as n
dim subby1 as c
counter=1
'subby1=padl(alltrim(str(val(c.subno)+1)),4,"0")
'subcount=alltrim(str(val(c.subno)+counter))
while countervartags)
subby1=padl(alltrim(str(val(lastrec)+counter)),4,"0")
c.enter_begin()
c.MAINNO = t.mainno
c.SUBNO = subby1
c.enter_end(.t.)
counter=counter+1
end while
end if
The problem I am getting is that when the script is executed, the computer says that you can't do "c.fetch_last" in Enter or change mode.
Can anyone tell me where I can correct this?
Thanks,
Charlie
I have a parent/child database that handles inventory labels. When these labels are purchased they need to be added to the inventory and then used later on.
I want the user to select a record in the parent, then use the following script on a button which will add the records to the child database.
The script is as follows (sorry for the jumble):
'Date Created: 27-Dec-2002 06:16:20 PM
'Last Updated: 28-Dec-2002 01:12:31 AM
'Created By :
'Updated By :
'Displays a message box (style:'OK Button', image: 'Attention symbol', id: 'Msg1').
DIM SHARED Msg1_result as N
DIM SHARED Msg1_OK_Button as L
Msg1_OK_Button = .F.
title_var = "Enter new Asset Labels"
message_text_var = vartags+\" additional labels to this main category of the database. Is this correct?\"")
Msg3_result=ui_msg_box(title_var,message_text_var,UI_OK_CANCEL+ UI_FIRST_BUTTON_DEFAULT+ UI_INFORMATION_SYMBOL)
'Test to see which button on the message box was pressed....
SELECT
CASE Msg3_result = UI_OK_SELECTED
Msg3_OK_Button= .t.
CASE Msg3_result = UI_CANCEL_SELECTED
Msg3_CANCEL_Button= .t.
END SELECT
dim lastrec as c
t=table.current(1)
c=table.current(2)
vartest=t.mainno
'vartest.refresh()
c.fetch_last()
if msg3_ok_button = .t. then
lastrec=c.subno
dim counter as n
'dim subcount as n
dim subby1 as c
counter=1
'subby1=padl(alltrim(str(val(c.subno)+1)),4,"0")
'subcount=alltrim(str(val(c.subno)+counter))
while countervartags)
subby1=padl(alltrim(str(val(lastrec)+counter)),4,"0")
c.enter_begin()
c.MAINNO = t.mainno
c.SUBNO = subby1
c.enter_end(.t.)
counter=counter+1
end while
end if
The problem I am getting is that when the script is executed, the computer says that you can't do "c.fetch_last" in Enter or change mode.
Can anyone tell me where I can correct this?
Thanks,
Charlie
Comment