- How to simplify reINSERTion of a deleted record while avoiding primary key violation error?
If a record is marked for deletion and now needs to be reinserted in a table
with primary key (pk) constraint, then I would usually do the following:
SELECT mytable
SET ORDER TO mytag_pk
IF SEEK(new_pk) && record with primary key new_pk already exists
* do something to inform the user that this record is already there
IF DELETED() && record with this key already exists but it's been deleted
RECALL && undelete
BLANK && clear all previously stored information
REPLACE pk_field WITH new_pk && restore key value
ENDIF
ELSE
INSERT INTO mytable (pk_field) VALUE (new_pk)
ENDIF
Can IF DELETED() part be skipped somehow?
So that to insert a record, I would only check whether it is in the table,
and insert it if not (keeping in mind primary key validation):
* something like this would work for me
IF !SEEK(new_pk,'mytable','mytag_pk') && all green, good to insert (unless
deleted)
INSERT INTO mytable (pk_field) VALUE (new_pk)
ENDIF Tag: General field (Picture) to Excel Tag: 182459
VFP on XP
I have a successfully running program orginally written
in VFP 5.0 running on Windows 98 computers. When running
the program from XP, I get the error "file in use" during
this code"
select custnote
mcutempnote = "tempfile\"+sys(3)+".dbf"
copy structure to (mcutempnote)
select 0
use (mcutempnote) excl alias tempnote
I have determined that it is an issue of the file still
being open after the copy structure and trying to open.
If I place a wait between the copy and use it works
100%. I have this pattern of code for about 10 times and
the error will move around - not always the same file.
Sometimes it will work maybe 5 times in a row - sometimes
not.
I have done fresh installs of XP, VFP 5.0, 6.0 and 8.0
with the same error. On a network or locally - doesn't
matter. No XP computer, here at work or at home will run
the application 100%, but all Window 98/95 do.
Anyone else have this issue? Have a suggestion?
Thanks Tag: General field (Picture) to Excel Tag: 182457
Spellchecker for RTF text?
Hi Everyone,
We use Foxspell for our spellchecking, but it doesn't work with the MS RTF
(rich text format) control. Has anyone successfully used a spellchecker with
this control?
Any recommendations?
Thanks.
--
William Fields
MCSD - Microsoft Visual FoxPro
MCP - Win2k Pro
US Bankruptcy Court
Phoenix, AZ
The secret to creativity is knowing how to hide your sources.
- Albert Einstein Tag: General field (Picture) to Excel Tag: 182456
VFP8 SP1
Just seen at MS-Download:
Visual FoxPro 8.0 Service Pack 1:
http://www.microsoft.com/downloads/details.aspx?FamilyID=018705e6-df6a-4695-965e-459fe5a761f7
Readme
http://download.microsoft.com/download/2/f/6/2f6db93f-c0e7-4cf3-82bf-cec0ecef5c84/SP1Readme.htm
Download:
http://download.microsoft.com/download/2/f/6/2f6db93f-c0e7-4cf3-82bf-cec0ecef5c84/VFP8SP1.exe
Web
http://msdn.microsoft.com/vfoxpro
--
Thomas Scheidegger - MVP .NET - 'NETMaster'
http://www.cetus-links.org/oo_dotnet.html - http://dnetmaster.net/ Tag: General field (Picture) to Excel Tag: 182454
CursorAdapter InsertCmd problem
We are having problems with InsertCmd constructed by
CursorAdapter. The cursor adapter is defined be the code
below. When we look at cInsertCmd in BeforeInsert method,
it is missing CID field, causing an insert error, since
CID is the priamry key field.
Any ideas why?
Text to This.Alias NoShow
V_ACNTGROUPID
EndText
Text to This.SelectCmd NoShow
SELECT
CID,CREATEDATE,CREATEUSER,MODDATE,MODUSER,NCODE_ID,CGROUP_I
D,CNAME,CDESCRIPTION FROM F099 WHERE F099.CGROUP_ID = ?
VP_GROUP_ID ORDER BY F099.CNAME
EndText
Text to This.KeyFieldList NoShow
CID
EndText
Text to This.UpdateNameList NoShow
CID F099.CID,CREATEDATE F099.CREATEDATE,CREATEUSER
F099.CREATEUSER,MODDATE F099.MODDATE,MODUSER
F099.MODUSER,NCODE_ID F099.NCODE_ID,CGROUP_ID
F099.CGROUP_ID,CNAME F099.CNAME,CDESCRIPTION
F099.CDESCRIPTION
EndText
Text to This.UpdatableFieldList NoShow
CID,CREATEDATE,CREATEUSER,MODDATE,MODUSER,NCODE_ID,CGROUP_I
D,CNAME,CDESCRIPTION
EndText
Text to This.CursorSchema NoShow
CID C(12),CREATEDATE T,CREATEUSER C(15),MODDATE T,MODUSER C
(15),NCODE_ID N(10,0),CGROUP_ID C(10),CNAME C
(20),CDESCRIPTION C(40)
EndText
This.Tables = [F099] Tag: General field (Picture) to Excel Tag: 182449
Report Group Break Does Not Reset Group Variable
I have a report that has one grouping and one variable that counts the
records in each group and gets reset when the group changes. I am
using this variable in the page header - if the count is over a
certain amount then I print something, else print something else.
Problem is that the variable does not get reset until the next groups
page header has already printed giving me the prior groups 'condition'
on the next group. Thus the variable does not actually get reset
until the first detail record of the next group gets printed even
though the header info has already printed and is obviously the next
grouping. Is there any way to reset the variable before the page
header prints since the record pointer is already pointing the the
next group?
I tried using a UDF that ran in the group footer that reset the
variable - that worked except in one case. If you had exactly the
number of detail group lines to fill one page exactly the UDF still
ran for the second page and caused the page to be blank and print the
group header and detail - no amount of supression worked. I even
removed the call to the UDF and put the word "help" in the field and
it still printed the second blank page even though it suppressed the
printing of 'help'. I have to remove everything from the group footer
for it not to print the blank page.
There has got to be someway to easily resolve all this.
Rick Tag: General field (Picture) to Excel Tag: 182447
Conflict between VFP 6 and Windows XP/2000/2003
I have an application that is running from several workstations that are all
using Windows XP. The data is stored on their server which is running either
Windows 2000 Server or 2003 Server. The application was written in Visual
FoxPro 6.0 with SP 3. The problem the client is having is that the program
locks up quite frequently. Sometimes it gives them the error message "Error
reading file". We have several clients running this program successfully but
are using Windows 98 or 2000. Does anybody know if VFP 6 has a problem with
Windows XP or 2000/3 Server? Is there a more recent service patch I need or
should I upgrade to a newer VFP?
Thanks.
Doug Tag: General field (Picture) to Excel Tag: 182438
FoxPro 6 bizarre behavior
In the following code:
IF POPUP("MyPopup")
mTotal = CNTBAR("MyPopup")
FOR mCount = 1 TO mTotal
mText = PRMBAR("MyPopup", mCount)
ENDFOR
ENDIF
Why would line 5 (the PRMBAR function call) generate error
1612 - menu or menu item not defined? Tag: General field (Picture) to Excel Tag: 182435
Oleboundcontrol, I could not see.
I developed a payroll system with a photo of the employee.
At the office I could see the picture perfectly well, but
when I installed the softwared I see the icon associated
with the extension of the file (in this case jpg), instead
of the photo.
I dissociate the extension, and re-associate to MS-Paint,
and now I see the Icon of paint.
What could I do? Any suggestion will be welcome.
Thanks in advance,
Mariano Tag: General field (Picture) to Excel Tag: 182424
Larger arrays
Hi
I am trying to realize the following code (for an HTTP file transfer):
b=THISFORM.inet1.OpenURL(StrURL, 1)
The THISFORM.inet1.OpenURL(StrURL, 1) returns an array
So b becomes an array.
The problem is that, if the file I am downloading exceeds the maximum array
dimension of VFP, then of course I get "Array dimensions are invalid".
Is there a way to create an array able to handle more than 65000 elements?
Demetrios, Greece Tag: General field (Picture) to Excel Tag: 182416
Optical Caracter Reco. or Optical Mark Readers + VFP
Hi, all
I would read paper forms based on checkboxes and analyse the answers thru VFP
Do you have any experience ?
and about OMR ? is it better than OCR solution?
... looking for an OCR ou OMR dll testable before buying
Thanks
--
Olivier (enlever les 3X pour la réponse) Tag: General field (Picture) to Excel Tag: 182411
Coding problem.
Hi All,
Just wanna make sure whether something wrong with the
following code. I created a button. As I clicked this
button, the following program will be executed. But
unfortunately only the first one works (column7). Is that
something wrong with my code? What the correct one should
be?
thisform.grdProducts.Column7.readonly=.F.
thisform.grdProducts.Column7.Backcolor=RGB(128,255,255)
thisform.grdProducts.Column8.readonly=.F.
thisform.grdProducts.Column8.Backcolor=RGB(128,255,255)
thisform.grdProducts.Column9.readonly=.F.
thisform.grdProducts.Column9.Backcolor=RGB(128,255,255)
thisform.grdProducts.Column10.readonly=.F.
thisform.grdProducts.Column10.Backcolor=RGB(128,255,255)
thisform.grdProducts.Column11.readonly=.F.
thisform.grdProducts.Column11.Backcolor=RGB(128,255,255)
thisform.grdProducts.Column12.readonly=.F.
thisform.grdProducts.Column12.Backcolor=RGB(128,255,255)
Thanks,
Sam. Tag: General field (Picture) to Excel Tag: 182405
Winsock Oddness
I'm attempting to use the winsock control to download files. What
follows is a conversion I did of some VB code (which works flawlessly
in VB).
My problem is I am getting dataarrival events, that when the "GetData"
is called, lcData starts with a first byte of value 00, followed by my
space characters that I put in. Ie, the actual data is not being
populated.
The wierd thing is that in say, an 800K file, I'm getting only one or
two 8192 byte blocks that go wrong.
My question is - can the winsock control be used reliably in foxpro to
do file downloading, given that I'm only getting this problem in the
foxpro version - the vb version hasn't missed a beat. It's quite
frustrating, and given that I am having these problems on my quite
good internet connection, I wonder whether it's really a go-er out
there in the real world.
This is the winsock control.dataarrival event
*** ActiveX Control Event ***
LPARAMETERS bytestotal
LOCAL lcData, liBreakPosition
lcData = REPLICATE(" ",bytestotal)
THISFORM.wscHTTP.Object.GetData(@lcData,8,bytestotal) && 8 is vbString
IF !THISFORM.dlHeaderReceived
&& Look for the end of the header - are we there yet?
liBreakPosition = AT(CRLF + CRLF, lcData)
IF liBreakPosition > 0
THISFORM.dlHeaderReceived=.T.
&& Add the rest of the header
THISFORM.dlHeader = THISFORM.dlHeader +
LEFT(lcData,liBreakPosition-1)
&& Write any part of "post header" actual data
FWRITE(THISFORM.dlOutputFD, SUBSTR(lcData, liBreakPosition +
4))
ELSE
&& Add what we just got to the "header + start of data"
section
THISFORM.dlHeader=THISFORM.dlHeader + lcData
ENDIF
ELSE
THISFORM.BytesDownloaded=THISFORM.BytesDownloaded + bytestotal
THISFORM.ReportStatus(TRANSFORM(THISFORM.BytesDownloaded))
FWRITE(THISFORM.dlOutputFD, lcData)
ENDIF Tag: General field (Picture) to Excel Tag: 182402
Anyone has a Class for Quickbooks?
I am looking for some Quickbook import funtionality using
Foxpro. Anyone has a Class template already?
Thanks,
Felix Serra Tag: General field (Picture) to Excel Tag: 182398
UniversalThread.com SUCKS !!!
This is a multi-part message in MIME format.
------=_NextPart_000_0008_01C38C5E.F6CC6270
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Thanks for making the UT magazine not available to everybody.
If you are going to start charging for other content too, good for you, =
but net communities are meant to be free and we will start posting =
samples and questions anywhere else.
For now, I will just delete you as one of my bookmarks and as a link in =
my website front page where you had the third place below MSDN and =
GotDotNet, not anymore.
BYE UT, YOU CAN NOW GO TO HELL !!!
------=_NextPart_000_0008_01C38C5E.F6CC6270
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1264" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2><FONT size=3D2>
<P>Thanks for making the UT magazine not available to everybody.</P>
<P>If you are going to start charging for other content too, good for =
you, but=20
net communities are meant to be free and we will start posting samples =
and=20
questions anywhere else.</P>
<P>For now, I will just delete you as one of my bookmarks and as a link =
in my=20
website front page where you had the third place below MSDN and =
GotDotNet, not=20
anymore.</P>
<P>BYE UT, YOU CAN NOW GO TO HELL =
!!!</P></FONT></FONT></DIV></BODY></HTML>
------=_NextPart_000_0008_01C38C5E.F6CC6270-- Tag: General field (Picture) to Excel Tag: 182394
Calling a function in another .prg from a .prg
program1.prg
--------------------
function square
parameters a
return a*a
endfunc
program2.prg
--------------------
a=2
?square(a)
Please advise the configuration of project file needed to achieve the above? Tag: General field (Picture) to Excel Tag: 182392
How do I code this...VFP8
Table Structures:
inventory.dbf
stockid
descript
retail
retailsale
ivdescription.dbf
stockid
descript
ivdescript.dbf stores multiple descriptions for each stockid.
My cursor will contain the following fields.
stockid
descript (from inventory.dbf)
retail
retailsale
descript_<n> for each matching stockid in ivdescript.dbf
select inventory.*, ivdescription.* from inventory ;
left join ivdescription on ivdescription.stockid = inventory.stockid ;
where inventory.adid = MyAds.adid ;
order by inventory.sku ;
into cursor MySpecials
This creates a cursor with multiple occurrences of the stockid.
Instead I want the extra descriptions to be as descript_a, descript_b,etc.
Basically, I need to print multiple descriptions on a report form detail
band.
I think I need to use some form of the group clause, but I'm not sure.
I don't want to set enginebehavior 70.
Thanks in advance.
John. Tag: General field (Picture) to Excel Tag: 182391
Thanks for the replies
Hello:
Thank you all for your replies. The majority of you
thinks I should just get acquainted with FoxPro more
intimately. I just get frustrated when reading a book it
sounds easy, but I I actually try it out, the code is
missing components. Well that kind of tells me either I
have a sucky book or, I must be approaching the book
wrong. I beleive the second option is more likely. I am
so used to texbook style. Step by