Open Error DBF with dash

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
serge_girard
Posts: 2482
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 776 times
Been thanked: 147 times
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 545 times

edk
Posts: 558
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 146 times
Been thanked: 486 times

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: 2482
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 776 times
Been thanked: 147 times
Contact:

Post by serge_girard »

Thanks !

Serge

Post Reply