Question : How to add a new value from a form onto a subform

Hi
Can anyone give me a bit of guidance about how to add a value in a field ie Type and add the same value into the field for type on the sub form for documents currently in the database. New ones pick up the field but i need to put it into documents already created and was wondering what the best way to go about it was.

Thanks for your help. Any advice is welcome.

Answer : How to add a new value from a form onto a subform

I'm guessing you are calling Windows API to copy files or similar, so you need only PChar and string types, and Delphi compiler will decide, according to the version, the correct kind and correct API version it will use.

With Delphi <2009 :
String = AnsiString
(P)Char = (P)AnsiChar
and all windows API called are the ANSI version , ex :
CopyFile = CopyFileA

With Delphi >=2009
String = WideString
Char = WideChar
and all windows API called are the Wide version


so, your code should be made to compile with all versions, without playing too much with other types except when you don't have choice
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
Var
 cDestino, cOrigem : PChar;
 sFile, sPath, sDiaSemana :String;
 iProgBar: Integer;
and;

  sFile := 'PedItem.db';
  cOrigem := strtopchar ( sPath+'\'+sFile );
  cDestino:= strtopchar ( 'C:\Back-up_AcxSir\'+sDiaSemana+sFile ); 
  CopyFile( cOrigem , cDestino , False ); 


Note that you can convert String to PChar with just a cast in the way aflarin shown for AnsiString & PAnsiChar. 
So you can even call your function in one line

  CopyFile( PChar( sPath+'\'+sFile ), PChar( 'C:\Back-up_AcxSir\'+sDiaSemana+sFile ) , False ); 
Random Solutions  
 
programming4us programming4us