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

Append from dbf question... 1

Status
Not open for further replies.

hudhwk

Programmer
Jan 28, 2003
80
MX
Hi guys,

I have this problem, when I do an "append from dbf" i get an error message of "alias not found" but it only happens the first time, if I run it for a second time it works just perfect, it sound like I am missing a declaration somewhere. Any idea?

Code:
select 2
  use w:cu_servs
  append from dbf( ['captura_movs'] )
  _screen.activeform.release

Thanks in advance.

Sincerely,

Daniel Buentello
"Here comes the hawk...
 
Try this:

LOCAL lcDbf

lcDbf = dbf('captura_movs')

select 2
use w:cu_servs
append from (lcDbf)
_screen.activeform.release


Best regards

Germán Restrepo
Bogotá, Colombia
 
Hi Germán,

Now it's telling me that the temporal file doesn't exists.

Thanks...

Daniel Buentello
"Here comes the hawk...
 
The biggest issue here is brackets [] and single quotes '' as well as double quotes "" are interchangable.
[dave] == 'dave' == "dave"

So what you're effectively doing is doubly quoting the table name.

Just use:
append from dbf('captura_movs')

However, make sure captura_movs is already open.



-Dave Summers-
[cheers]
Even more Fox stuff at:
 
I have VFP 6.0 and change everything that you said, and still doesn't work...

Any idea???

Thanks in advance...

Sincerely

Daniel Buentello.
"Here comes the hawk...
 
Daniel,

Try:
Code:
LOCAL lcDbf

lcDbf = 'captura_movs.dbf'

select 2
  use w:cu_servs
  append from (lcDbf)
  _screen.activeform.release

Koen
 

Daniel,

It looks like you missing opening a table, not a declaration.

DBF()function returns the name of a table open in a specified work area or a table name from a table alias.

Thus,
APPEND FROM DBF('MyTable')
would work only on a table that is already open with alias MyTable.

E.g.

lcDbf="D:\Long Dir Name\MyDir\TheTable"

USE (lcDbf) IN 0 SHARED ALIAS MyTable
SELECT TargetTable
APPEND FROM DBF('MyTable')

If you want to append from a table that is not open,
use

SELECT TargetTable
APPEND FROM (lcDbf)

 
Maybe I am making a big mistake.

I forgot to tell you, that the source database is a cursor.

Do you think is that the reason?
 

How do you create it?
Can you also show your corrected code that still doesn't work?

In general, you can append from cursor by using
APPEND FROM DBF('MyCursor')

There could be problems if FoxPro created the cursor by just applying filter to the original table - but not "alias not found" kind of problem.



 
Sure,

Here it goes.

Code:
create cursor captura_movs (mcve c(15), mdes c(30), mstat c(13), mresp c(13), mmemo c(13), mswap c(13), mobs m)
 

So this is the source cursor?

SELECT TargetTable
APPEND FROM DBF('captura_movs')

works with no problem for me. So what line of code doesn't work? Can you show it?
 
the line that is telling me the problem is:

APPEND FROM DBF('captura_movs')
 

It looks like there is no problem with APPEND in itself, there is something wrong with the scope of your cursor - it is not seen at the point where you are trying to append from it. It could have something to do with private data session, I would guess.

Did you try to run it from command window?

Can you explain your set up? Someone here might have seen your situation.
 
Are you closing the cursor before trying to append from it?
Code:
create cursor captura_movs ;
   (mcve c(15), mdes c(30), mstat c(13), ;
    mresp c(13), mmemo c(13), mswap c(13), mobs m)

USE w:cu_servs
APPEND FROM DBF('captura_movs')
Will close the cursor.

Whereas:
Code:
create cursor captura_movs ;
   (mcve c(15), mdes c(30), mstat c(13), ;
    mresp c(13), mmemo c(13), mswap c(13), mobs m)

[COLOR=blue]SELECT 0[/color]
USE w:cu_servs
APPEND FROM DBF('captura_movs')
Should work.

-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Guys,

Exactly. The problem was the the selected area, y changed it to 0 and worked perfectly, the cursor was in the area 2 so when I use the cu_servs it got destroyed.

Thanks a lot to every one!!!

Have a great day.

Sincerely,
Daniel Buentello
"Here comes the hawk...
 

For the future, don't use SELECT number.
Besides causing inconveniences, it's just not VFP way of doing things.
Do SELECT 0, and then refer to the area by alias.
 
Alright!

I'll keep it in mind.

Thanks everyone.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top