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

Can anyone help me ?

Status
Not open for further replies.

capri1966

Programmer
May 13, 2010
57
ES
Hi, i've an accounts application and i've some problems with this. In an instalation the app is locked when executes GOTO BOTTOM and i haven't what this occours.
The code is this:

if Thisformset.lNuevoRealizado=.T.
return
endif
This.valido()
if apuntes.apte < This.maxapte
return
endif
if This.lPermiso=.F.
wait window "APUNTE INCORRECTO..."+chr(13)+"APUNTE INCORRECTO..."+chr(13)+"APUNTE INCORRECTO..." timeout 4
nodefault
return
endif
This.Activalias()
local lnNextApt,cUltiClave,lcFiltro,lnPosicionRegistro
lnPosicionRegistro=recno('apuntes')
lcFiltro=''
lcFiltro=SET('FILTER')
set filter to
lnNextApt=0
GOTO BOTTOM
if This.lUltimoForzado=.F.
This.cargaapunte()
endif
if reccount('apuntes')=0 or Eof('apuntes')
Thisformset.lEstadoApunte()
if This.lEmptyApte=.T.
This.lEmptyApte=.F.
endif
endif
if This.lUltimoForzado=.T.
This.lUltimoForzado=.F.
This.lEmptyApte=.F.
endif
if This.lEmptyApte=.F.
lnNextApt=val(apuntes.apte)
lnNextApt=lnNextApt+1
cUltiClave=padl(alltrim(str(lnNextApt)),8,'0')
INSERT INTO apuntes (apte, diario, asiento, marca3) VALUES(cUltiClave, cFiltroDatos,This.cAsiento," ")
else
cUltiClave=apuntes.apte
endif
This.maxapte=cUltiClave
=TABLEUPDATE(.T.)
if !empty(lcFiltro)
set filter to apuntes.diario=cFiltroDatos
endif
Thisformset.form1.campogen1.refresh()

Thie fails is in GOTO BOTTOM, when is executed the system fails. The buffersmodeoverride y set to 3 and SET MULTILOCKS ON, but then do this, the app is locked, i've to run the tasks and close it the app. Can anyone to explain what is wrong in this ocde ?. Thank you so much
 
Looks like your app is in Spanish, and if my limited Spanish is right, it's there in your first line...

IF Thisformset.lNuevoRealizado = .T.

(Does that translate something to "At the End" (NuevoRealizado)

What that does immediatly after is:

RETURN

Which means, Go Back Now, and nothing else happens. (this is of course just a logical field in your formset...

And if you So it seems it may be that your "GO BOTT" then reenters this code snippet, and that tells it to go back, as the value for lNuevoRealizado is getting set to .T. somewhere (outside this snippet).

Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
The 'if Thisformset.lNuevoRealizado=.T....', avoid add records in the table if the cursor in backward in the file
 
And another way to say "Cursor is backward in file" is to say "EOF" or "End of File" which is exactly what a Go BOTT (Go Bottom) will do: put you at the last record in the file.


Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
No, when i say 'cursor is backward in the file' i mean that is in previous records becouse the user can go back to modify previous records. The problem is when GOTO BOTTOM y executed, the app fails, is it freeze the screen and is locked all app, In the goto bottom, this occours only when is in network environment, when the app
run in a unique computer, it's run ok
 
Well, GO BOTTOM executes on whatever the currently selected table is.
In the code you list above, there is no reference table.
Try putting a line just before the "GO BOTTOM" of

...
SELECT <TABLENAME>
GO BOTTOM
...

And see if that solves your problem. Sometimes it's just executing on the wrong table. Since you said it works fine in one environment but not in another, this could easily be the case.
-S

Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
The table is selected in the This.activaalias() method, the code faild when is in network environment, only in this case.
 
That that code may not be passing the correct table.

Check it with MESSAGEBOX(This.activaalia()) and see what table it reports it is on. You may find it is not.
If it returns ""
Or returns a table name other than the one you expect, then set the table explicitly with SELECT <tablename> If you're worried about desrtoying environment do this:

lcCurTable = This.actrivaalias()
SELECT <Table>
GO BOTT
SELECT &lcCurTable

that will keep your environment intact, while getting the right table set for your GO BOTTOM call.


Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Capri,

I won't try to answer your question, as I see that Scott has already given you a lot of help. But let me make two suggestions to help in the future.

First, give your question a meaningful title - something that will tell forum members roughly what the topic is about. Doing that will help anyone browsing the forum and looking for questions to answer, as well as those who might have a similar problem.

With that in mind, "Can anyone help me?" is a completely useless title. It tells us absolutely nothing about the problem. It could relate to just about any topic in the forum.

My second suggestion is that you use code formatting when posting large amounts of code. To do that, either surround the code with [ignore]
Code:
[/ignore] tags, or use the "code" button on the toolbar (just above the area where you type your message).

By doing that, your code will appear in an appropriate monospaced font, with all the indentation preserved. That in turn will make it easier to read and to understand.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
What have you done to try to determine the problem yourself?

Have you put SET STEP ON code lines into your existing code so that the application will break execution if run from the Command Window?

If you had inserted a line like that a line or two before your problem, you would then be able to examine the data tables, etc. with the Data Session window.
And you would be able to examine other parts of your application.

Instead of the SET STEP ON code lines you could insert a BREAKPOINT, but in order for it to execute a BREAK, you would first have to have your TRACE or DEBUG window manually opened.

Good Luck,
JRB-Bldr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top