Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Record Not Selected When Using Multiple Forms
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Record Not Selected When Using Multiple Forms
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01152103
Message ID:
01152103
Views:
81
Hey gurus,

I have a grid that's populated with work orders (the main form). When I select
a work order and click a "modify" button (it brings up a form called "wo"),
I can modify the work order, save changes, cancel, and so forth. On the form "wo",
I have button called "invoices" that pulls up another form called "inv," and
this is where thing fall apart/break.


Now, suppose I select work order # 1111 from the grid and hit the "modify" command button.
Doing this selects that particular, unique record and brings up the "wo" form. Next I select
the "invoices" command button, and the "inv" form pops up. Next I cancel out of this "inv" form
and drop back to the "wo" form. Next I cancel out of "wo" and drop back to main form. Then I select
another different work order(say 2222)from the grid for modification. When I do this, the "wo"
form still pulls data related to the previuos work order (# 1111), and it doesn't pull up
work order # 2222. The program is acting as if it's stuck on the original record and can't
select a new work order.


This is the code in the click event of the "modify" button:
---------------------------------------------------------------------
womod = createobject("mysql_mod",ALLTRIM(myserver),ALLTRIM(myUser),ALLTRIM(myPass),"test")--> Mysql DB 
womod.selectcmd = oWo.iniselect + " where wi = '" + ALLTRIM(worder_cur.wi)+"'" --> sql query for Mysql
womod.cursorrefresh()
womod.cursorfill()

DO FORM wo WITH worder_cur.wi && worder_cur.wi is the primary key of the "WO" table in Mysql
This is the code in the init event of the form "wo."
---------------------------------------------------
LPARAMETERS twoid  && this is the primary key of the work order being passed
thisform.woid = twoid

IF PCOUNT() = 0   && if no parameter is passed then it is a new work order 
lnJn = wo.jn+1    && here jn is the work order number in the table wo 
APPEND BLANK
thisform.woid = SYS(2015)
replace wi WITH thisform.woid IN wo  && wi is the primary key
replace jn WITH lnJn IN wo
thisform.newwo = .T.
SELECT wo
TABLEUPDATE(.T.)

ENDIF

WITH this
.txtAFE.controlsource = "wo.afe"  && populating the textboxes with data..
.txtBlock.controlsource = "wo.bl"
.txtRig.controlsource = "wo.rg" 
.txtBase.controlsource = "wo.sb" 
endwith

thisform.refresh()
What gives?

Regards and TIA,

Randall
--
Randall Jouett
Amateur/Ham Radio: AB5NI
I eat spaghetti code out of a bit bucket while sitting at a hash table! Someone
asked me if I needed salt, and I said, "I'm not into encryption." :^)
Next
Reply
Map
View

Click here to load this message in the networking platform