Hello Mike Gagnon!
Sequences of events:
1. Startup program which has the '_Screen.Visible = .F.'. This program calls the login from.
2. The login form calls the Main Menu which is where the date range parameters are entered. Parameters XRANGE1 and XRANGE2.
3. Main menu calls the update form. This where the parameters are being passed to. XRANGE1 and XRANGE2 are used to filter the grid.
This update form contains 3 text fields (no controls), a combobox and a grid.
What's odd is when the user goes into the form everything is fine. If the user does anything with the grid first and then adds a record no errors occur.
If the user goes into the form and adds a record first the error "variable 'XRANGE2' is not found" occurs.
Below is my code for this screen.
UPDATE SCREEN ----------------------------------------------** INIT CODE
LPARAMETERS xrange1, xrange2, xckbgn
SET PATH TO C:\book, C:\book\data
SET DELETED ON
SET TALK OFF
Thisform.MinButton = .F. && Removes the Min Button
Thisform.MaxButton = .F. && Removes the Max Button
Thisform.Closable = .F. && Deactivates the little X
SET CENTURY ON
select chckbal
scan for chckbal.castrt = thisform.text1.Value AND chckbal.castrt = thisform.text2.Value
exit
ENDSCAN
xckbgn = cabbal
SELECT book
SET ORDER TO WIZARD_1
SET FILTER TO book.bbdate >= xrange1 AND book.bbdate <= xrange2
GO TOP
THISFORM.GRID1.Refresh()
WITH Thisform
.text7.value = xckbgn
SELECT book
.TXTDeprttl.visible = .F.
.TXTChkrttlp.visible = .F.
.TXTChkrttl.visible = .F.
.TXTAmtottl.visible = .F.
.TXTwrrttl.visible = .F.
.TXTeftrttl.visible = .F.
.text5.value = xrange1
.text6.value = xrange2
ENDWITH
** SAVE BUTTON CLICK --------------------------------
xacco = thisform.combo1.value
scan for Accounts.acdesc = xacco
exit
ENDSCAN
xcate = Accounts.cate
xcate = TRIM(xcate)
** -----------------------------------------------
** ------ SAVE -----------------------------------
** -----------------------------------------------
WITH Thisform
SELECT book
SET MULTILOCKS ON
= CURSORSETPROP('Buffering', 5, 'book' )
IF xcate = "DEP" then
sDate = .txtDate.value
sDesc = .Combo1.value
sDepAmt = .text1.value
Insert INTO book (bbDate, Desc, Depamt) values (sDate, sDesc, sDepAmt)
ELSE
IF xcate = "PYR" then
sDate = .txtDate.value
sDesc = .Combo1.value
sChkamtp = .text1.value * -1
sChknop = .text2.value
Insert INTO book (bbDate, Desc, Chknop, Chkamtp) values (sDate, sDesc, sChknop, sChkamtp)
ELSE
IF xcate = "PAY" then
sDate = .txtDate.value
sDesc = .Combo1.value
sChkamt = .text1.value * -1
sChkno = .text2.value && Payables No.
Insert INTO book (bbDate, Desc, Chkno, Chkamt) values (sDate, sDesc, sChkno, sChkamt)
ENDIF
ENDIF
ENDIF
= TABLEUPDATE(1,.T.)
thisform.recalc1
ENDWITH
** ------------------------------------------------
** --ADD-------------------------------------------
** ------------------------------------------------
WITH Thisform
zDate = .txtDate.Value
.text1.value = 0.00
.text1.Refresh()
.text2.value = ' '
.text2.Refresh()
.combo1.SetFocus()
ENDWITH