Open Error DBF with dash

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
serge_girard
Posts: 3167
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Open Error DBF with dash

Post by serge_girard »

Does anybody know how to avoid this error:
It appears when opening a DBF with a dash char in it's name. Open the DBF file with a DBF viewer is no problem

Code: Select all

Subsystem 	DBFNTX
Subcode	1001
CanDefault	True
CanRetry	True
Description	Open error
Operation	
Filename	03012014-F0001.dbf
Oscode	2
Gencode	21
Severity	2
Thanks, Serge
Attachments
dbfvw.png
dbfvw.png (15.6 KiB) Viewed 1503 times
There's nothing you can do that can't be done...
edk
Posts: 914
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Open Error DBF with dash

Post by edk »

Hi Serge.

The problem is not the file name but Alias, which, if not declared, will take the file name. From what I remember, Alias cannot begin with a digit, it cannot contain a dash, comma, semicolon, spaces, period, etc.

Code: Select all

cDBF:='03012014-F0001.dbf'
Select 1
use &(cDbf) alias &(IF(IsDigit(hb_FNameName(cDBF)), '_', '') + StrTran(hb_FNameName(cDBF), "-","_"))
msgdebug(alias())
EDIT EXTENDED
User avatar
serge_girard
Posts: 3167
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Open Error DBF with dash

Post by serge_girard »

Thanks !

Serge
There's nothing you can do that can't be done...
Post Reply