726

(11 replies, posted in General)

Hi Derek,


Thanks a lot...............


I got the students part later on using button4, same way as you did with button5, thanks to your fix for another member.


However, I cannot get course details displayed for selected school.

727

(11 replies, posted in General)

I couldn't get my head around on this.


Due to too may fields (in actual project) I've created different db tables and linked to main table. However, I cannot get sub records details displayed.


Please see the sample project below. I have added additional info about the issue on forms:

728

(48 replies, posted in General)

Thank you very much Dmitry..................

729

(5 replies, posted in General)

Hi zahar,


Perhaps this topic may be of help
http://myvisualdatabase.com/forum/viewtopic.php?id=2886

730

(48 replies, posted in General)

AD1408 wrote:

I have a memo field with multiple pages of text. On report designer, I cannot get it displayed beyond first page. Tried different bands, stretch, set clipped to false but no luck.


I still couldn't find a solution. Help would be appreciated

731

(2 replies, posted in General)

Thanks a lot bemorhona-qt.................


My 1 cell brain failed to spot that simple mistake.

732

(2 replies, posted in General)

procedure CalculateTotal;
var
WinPercent, LossPercent: Real;
WinPercent2, LossPercent2: Real;
TotalNetProfit: Currency;
begin
  WinPercent:= frmValidation.edValidWLwinPerc.value;
  LossPercent:= frmValidation.edValidWLlossPerc.Value;
  WinPercent2:= frmValidation.edResultsWLWinPercent.value;
  LossPercent2:= frmValidation.edResultsWLLossPercent.Value;
  TotalNetProfit:= frmValidation.edValidTotalNetProfit;
    begin
     if (frmValidation.edValidWLwinCount.Value <> 0) and (frmValidation.edValidWLlossCount.Value <> 0) then
       begin
        frmValidation.edValidWLwinPerc.Value := frmValidation.edValidWLwinCount.value / (frmValidation.edValidWLwinCount.value + frmValidation.edValidWLlossCount.value) * 100;
        frmValidation.edValidWLlossPerc.Value := frmValidation.edValidWLlossCount.value / (frmValidation.edValidWLwinCount.value + frmValidation.edValidWLlossCount.value) * 100;
       end;
     if (frmValidation.edResultsWLWinCount.Value <> 0) and (frmValidation.edResultsWLLossCount.Value <> 0) then
        begin
         frmValidation.edResultsWLWinPercent.Value := frmValidation.edResultsWLWinCount.value / (frmValidation.edResultsWLWinCount.value + frmValidation.edResultsWLLossCount.value) * 100;
         frmValidation.edResultsWLLossPercent.Value := frmValidation.edResultsWLLossCount.value / (frmValidation.edResultsWLWinCount.value + frmValidation.edResultsWLLossCount.value) * 100;
        end;

     if (frmValidation.edValidEndBal.Value <> 0) and (frmValidation.edValidStartBal.Value <> 0) then
        begin
         frmValidation.edValidTotalNetProfit:= frmValidation.edValidEndBal.value - frmValidation.edValidStartBal;  //frmValidation - TOTAL NET PROFIT CALC
        end;


     end;
end;

I get the error for the line below within script above:

TotalNetProfit:= frmValidation.edValidTotalNetProfit;

What's missing or wrong please?

733

(48 replies, posted in General)

Another wall I hit on FR......


I have a memo field with multiple pages of text. On report designer, I cannot get it displayed beyond first page. Tried different bands, stretch, set clipped to false but no luck.


Please see the attached sample projects:

734

(15 replies, posted in General)

Thanks rj kantor..... do you have have something working that you can share?


Dmitry,
What other parts Serial / ID of a computer MVD can read beside hdd?

735

(15 replies, posted in General)

Hi lostdb,
Thanks a lot  for the info........ When you say "sample here in forum" what do you mean?


Dmitry,
What other parts Serial / ID of a computer MVD can read beside hdd?

736

(15 replies, posted in General)

I have been looking into how to protect an app created with MVD fairly good.


The issue is been discussed on the following topic with some interesting suggestions.
http://myvisualdatabase.com/forum/viewtopic.php?id=932


Dmitry kindly provides registry based protection. However, as far as I understand this method doesn't prevent a users distributing the application with their registration details to others to run it their own computers without registration.


I found one interesting suggestion by Rob in the topic above:

Another way is to provide the user a mechanism to provide you, the license provider, a code that is generated based on their NIC or motherboard sn.  The license key that is provided to the user uses this code value as part of the generated key.  Therefore, if they try to install the software on another machine, the key will not work for that new machine.
Rob

Here is a project in line of Robs suggestion. . "Generating a “unique” hardware ID using Delphi and the WMI" - by Rodrigo. He provides the code.
https://theroadtodelphi.com/2010/12/02/ … d-the-wmi/


Now the question is could Dmitry or somebody convert the delphi code into MVD?
I understand that some functions of Delphi may not be supported in MVD. I hope something similar can be done.


How I think it may work is as follows:
1. When user installs the trial app, unique virtual machine ID generated and displayed on custom About window of trial app.
2. User sends his/her virtual machine ID to developer and developer compiles app with user's unique virtual machine ID and sends to user. It'd be hard coded activation. Therefore it will only run on specific machine.


Unique virtual machine ID should include multiple hardware IDs/serial numbers. User may change their hard disk, motherboard etc. App will run if x numbers of specified hardware is present rather than requiring all specified hardware be present. This would help to reduce issues arising with hardware changes on the user machine.


Rodrigo's Delphi code:

program WMIHardwareID;
 
{$APPTYPE CONSOLE}
{$DEFINE Use_Jwscl} //necessary to obtain a hash of the data using md2, md4, md5 or sha1
 
uses
  {$IFDEF Use_Jwscl}
  JwsclTypes,
  JwsclCryptProvider,
  {$ENDIF}
  Classes,
  SysUtils,
  ActiveX,
  ComObj,
  Variants;
 
type
   TMotherBoardInfo   = (Mb_SerialNumber,Mb_Manufacturer,Mb_Product,Mb_Model);
   TMotherBoardInfoSet= set of TMotherBoardInfo;
   TProcessorInfo     = (Pr_Description,Pr_Manufacturer,Pr_Name,Pr_ProcessorId,Pr_UniqueId);
   TProcessorInfoSet  = set of TProcessorInfo;
   TBIOSInfo          = (Bs_BIOSVersion,Bs_BuildNumber,Bs_Description,Bs_Manufacturer,Bs_Name,Bs_SerialNumber,Bs_Version);
   TBIOSInfoSet       = set of TBIOSInfo;
   TOSInfo            = (Os_BuildNumber,Os_BuildType,Os_Manufacturer,Os_Name,Os_SerialNumber,Os_Version);
   TOSInfoSet         = set of TOSInfo;
 
const //properties names to get the data
   MotherBoardInfoArr: array[TMotherBoardInfo] of AnsiString =
                        ('SerialNumber','Manufacturer','Product','Model');
 
   OsInfoArr         : array[TOSInfo] of AnsiString =
                        ('BuildNumber','BuildType','Manufacturer','Name','SerialNumber','Version');
 
   BiosInfoArr       : array[TBIOSInfo] of AnsiString =
                        ('BIOSVersion','BuildNumber','Description','Manufacturer','Name','SerialNumber','Version');
 
   ProcessorInfoArr  : array[TProcessorInfo] of AnsiString =
                        ('Description','Manufacturer','Name','ProcessorId','UniqueId');
 
type
   THardwareId  = class
   private
    FOSInfo         : TOSInfoSet;
    FBIOSInfo       : TBIOSInfoSet;
    FProcessorInfo  : TProcessorInfoSet;
    FMotherBoardInfo: TMotherBoardInfoSet;
    FBuffer         : AnsiString;
    function GetHardwareIdHex: AnsiString;
  {$IFDEF Use_Jwscl}
    function GetHashString(Algorithm: TJwHashAlgorithm; Buffer : Pointer;Size:Integer) : AnsiString;
    function GetHardwareIdMd5: AnsiString;
    function GetHardwareIdMd2: AnsiString;
    function GetHardwareIdMd4: AnsiString;
    function GetHardwareIdSHA: AnsiString;
  {$ENDIF}
   public
     //Set the properties to  be used in the generation of the hardware id
    property  MotherBoardInfo : TMotherBoardInfoSet read FMotherBoardInfo write FMotherBoardInfo;
    property  ProcessorInfo : TProcessorInfoSet read FProcessorInfo write FProcessorInfo;
    property  BIOSInfo: TBIOSInfoSet read FBIOSInfo write FBIOSInfo;
    property  OSInfo  : TOSInfoSet read FOSInfo write FOSInfo;
    property  Buffer : AnsiString read FBuffer; //return the content of the data collected in the system
    property  HardwareIdHex : AnsiString read GetHardwareIdHex; //get a hexadecimal represntation of the data collected
  {$IFDEF Use_Jwscl}
    property  HardwareIdMd2  : AnsiString read GetHardwareIdMd2; //get a Md2 hash of the data collected
    property  HardwareIdMd4  : AnsiString read GetHardwareIdMd4; //get a Md4 hash of the data collected
    property  HardwareIdMd5  : AnsiString read GetHardwareIdMd5; //get a Md5 hash of the data collected
    property  HardwareIdSHA  : AnsiString read GetHardwareIdSHA; //get a SHA1 hash of the data collected
  {$ENDIF}
    procedure GenerateHardwareId; //calculate the hardware id
    constructor  Create(Generate:Boolean=True); overload;
    Destructor  Destroy; override;
   end;
 
function VarArrayToStr(const vArray: variant): AnsiString;
 
  function _VarToStr(const V: variant): AnsiString;
  var
  Vt: integer;
  begin
   Vt := VarType(V);
      case Vt of
        varSmallint,
        varInteger  : Result := AnsiString(IntToStr(integer(V)));
        varSingle,
        varDouble,
        varCurrency : Result := AnsiString(FloatToStr(Double(V)));
        varDate     : Result := AnsiString(VarToStr(V));
        varOleStr   : Result := AnsiString(WideString(V));
        varBoolean  : Result := AnsiString(VarToStr(V));
        varVariant  : Result := AnsiString(VarToStr(Variant(V)));
        varByte     : Result := AnsiChar(byte(V));
        varString   : Result := AnsiString(V);
        varArray    : Result := VarArrayToStr(Variant(V));
      end;
  end;
 
var
i : integer;
begin
    Result := '[';
    if (VarType(vArray) and VarArray)=0 then
       Result := _VarToStr(vArray)
    else
    for i := VarArrayLowBound(vArray, 1) to VarArrayHighBound(vArray, 1) do
     if i=VarArrayLowBound(vArray, 1)  then
      Result := Result+_VarToStr(vArray[i])
     else
      Result := Result+'|'+_VarToStr(vArray[i]);
 
    Result:=Result+']';
end;
 
function VarStrNull(const V:OleVariant):AnsiString; //avoid problems with null strings
begin
  Result:='';
  if not VarIsNull(V) then
  begin
    if VarIsArray(V) then
       Result:=VarArrayToStr(V)
    else
    Result:=AnsiString(VarToStr(V));
  end;
end;
 
{ THardwareId }
 
constructor THardwareId.Create(Generate:Boolean=True);
begin
   inherited Create;
   CoInitialize(nil);
   FBuffer          :='';
   //Set the propeties to be used in the hardware id generation
   FMotherBoardInfo :=[Mb_SerialNumber,Mb_Manufacturer,Mb_Product,Mb_Model];
   FOSInfo          :=[Os_BuildNumber,Os_BuildType,Os_Manufacturer,Os_Name,Os_SerialNumber,Os_Version];
   FBIOSInfo        :=[Bs_BIOSVersion,Bs_BuildNumber,Bs_Description,Bs_Manufacturer,Bs_Name,Bs_SerialNumber,Bs_Version];
   FProcessorInfo   :=[];//including the processor info is expensive [Pr_Description,Pr_Manufacturer,Pr_Name,Pr_ProcessorId,Pr_UniqueId];
   if Generate then
    GenerateHardwareId;
end;
 
destructor THardwareId.Destroy;
begin
  CoUninitialize;
  inherited;
end;
 
//Main function which collect the system data.
procedure THardwareId.GenerateHardwareId;
var
  objSWbemLocator : OLEVariant;
  objWMIService   : OLEVariant;
  objWbemObjectSet: OLEVariant;
  oWmiObject      : OLEVariant;
  oEnum           : IEnumvariant;
  iValue          : LongWord;
  SDummy          : AnsiString;
  Mb              : TMotherBoardInfo;
  Os              : TOSInfo;
  Bs              : TBIOSInfo;
  Pr              : TProcessorInfo;
begin;
  objSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator');
  objWMIService   := objSWbemLocator.ConnectServer('localhost','root\cimv2', '','');
 
  if FMotherBoardInfo<>[] then //MotherBoard info
  begin
    objWbemObjectSet:= objWMIService.ExecQuery('SELECT * FROM Win32_BaseBoard','WQL',0);
    oEnum           := IUnknown(objWbemObjectSet._NewEnum) as IEnumVariant;
    while oEnum.Next(1, oWmiObject, iValue) = 0 do
    begin
      for Mb := Low(TMotherBoardInfo) to High(TMotherBoardInfo) do
       if Mb in FMotherBoardInfo then
       begin
          SDummy:=VarStrNull(oWmiObject.Properties_.Item(MotherBoardInfoArr[Mb]).Value);
          FBuffer:=FBuffer+SDummy;
       end;
       oWmiObject:=Unassigned;
    end;
  end;
 
  if FOSInfo<>[] then//Windows info
  begin
    objWbemObjectSet:= objWMIService.ExecQuery('SELECT * FROM Win32_OperatingSystem','WQL',0);
    oEnum           := IUnknown(objWbemObjectSet._NewEnum) as IEnumVariant;
    while oEnum.Next(1, oWmiObject, iValue) = 0 do
    begin
      for Os := Low(TOSInfo) to High(TOSInfo) do
       if Os in FOSInfo then
       begin
          SDummy:=VarStrNull(oWmiObject.Properties_.Item(OsInfoArr[Os]).Value);
          FBuffer:=FBuffer+SDummy;
       end;
       oWmiObject:=Unassigned;
    end;
  end;
 
  if FBIOSInfo<>[] then//BIOS info
  begin
    objWbemObjectSet:= objWMIService.ExecQuery('SELECT * FROM Win32_BIOS','WQL',0);
    oEnum           := IUnknown(objWbemObjectSet._NewEnum) as IEnumVariant;
    while oEnum.Next(1, oWmiObject, iValue) = 0 do
    begin
      for Bs := Low(TBIOSInfo) to High(TBIOSInfo) do
       if Bs in FBIOSInfo then
       begin
          SDummy:=VarStrNull(oWmiObject.Properties_.Item(BiosInfoArr[Bs]).Value);
          FBuffer:=FBuffer+SDummy;
       end;
       oWmiObject:=Unassigned;
    end;
  end;
 
  if FProcessorInfo<>[] then//CPU info
  begin
    objWbemObjectSet:= objWMIService.ExecQuery('SELECT * FROM Win32_Processor','WQL',0);
    oEnum           := IUnknown(objWbemObjectSet._NewEnum) as IEnumVariant;
    while oEnum.Next(1, oWmiObject, iValue) = 0 do
    begin
      for Pr := Low(TProcessorInfo) to High(TProcessorInfo) do
       if Pr in FProcessorInfo then
       begin
          SDummy:=VarStrNull(oWmiObject.Properties_.Item(ProcessorInfoArr[Pr]).Value);
          FBuffer:=FBuffer+SDummy;
       end;
       oWmiObject:=Unassigned;
    end;
  end;
 
end;
 
function THardwareId.GetHardwareIdHex: AnsiString;
begin
    SetLength(Result,Length(FBuffer)*2);
    BinToHex(PAnsiChar(FBuffer),PAnsiChar(Result),Length(FBuffer));
end;
 
{$IFDEF Use_Jwscl}
function THardwareId.GetHashString(Algorithm: TJwHashAlgorithm; Buffer : Pointer;Size:Integer) : AnsiString;
var
  Hash: TJwHash;
  HashSize: Cardinal;
  HashData: Pointer;
begin
  Hash := TJwHash.Create(Algorithm);
  try
    Hash.HashData(Buffer,Size);
    HashData := Hash.RetrieveHash(HashSize);
    try
        SetLength(Result,HashSize*2);
        BinToHex(PAnsiChar(HashData),PAnsiChar(Result),HashSize);
    finally
      TJwHash.FreeBuffer(HashData);
    end;
  finally
    Hash.Free;
  end;
end;
 
function THardwareId.GetHardwareIdMd2: AnsiString;
begin
   Result:=GetHashString(haMD2,@FBuffer[1],Length(FBuffer));
end;
 
function THardwareId.GetHardwareIdMd4: AnsiString;
begin
   Result:=GetHashString(haMD4,@FBuffer[1],Length(FBuffer));
end;
 
function THardwareId.GetHardwareIdMd5: AnsiString;
begin
   Result:=GetHashString(haMD5,@FBuffer[1],Length(FBuffer));
end;
 
function THardwareId.GetHardwareIdSHA: AnsiString;
begin
   Result:=GetHashString(haSHA,@FBuffer[1],Length(FBuffer));
end;
 
{$ENDIF}
 
//testing the THardwareId object
var
  HWID : THardwareId;
  dt   : TDateTime;
begin
 try
    HWID:=THardwareId.Create(False);
    try
       dt := Now;
       HWID.GenerateHardwareId;
       dt := now - dt;
       Writeln(Format('Hardware Id Generated in %s',[FormatDateTime('hh:mm:nn.zzz',dt)]));
       Writeln(Format('%s %s',['Buffer ',HWID.Buffer]));
       Writeln('');
       Writeln(Format('%s %s',['Hex  ',HWID.HardwareIdHex]));
      {$IFDEF Use_Jwscl}
       Writeln(Format('%s %s',['Md2  ',HWID.HardwareIdMd2]));
       Writeln(Format('%s %s',['Md4  ',HWID.HardwareIdMd4]));
       Writeln(Format('%s %s',['Md5  ',HWID.HardwareIdMd5]));
       Writeln(Format('%s %s',['SHA1 ',HWID.HardwareIdSHA]));
      {$ENDIF}
      Readln;
    finally
     HWID.Free;
    end;                                                   
 except
    on E:Exception do
    begin
        Writeln(E.Classname, ':', E.Message);
        Readln;
    end;
  end;
end.

Hi bemorhona-qt,


Thank you so much for your kind help..................


I couldn't think of including operator <>
I guess you assign a value so that it  knows the reference value to calculate the difference from?

I was trying to do simple win/loss percent calc.
With one calc it worked fine. When I added another win/loss calc on same page it returns "Invalid floating point operation"


The script below works with one calc on the same page:

procedure CalculateTotal;
begin
  Form1.edWinPercent.Value := Form1.edWinCount.value / (Form1.edWinCount.value + Form1.edLossCount.value) * 100;
  Form1.edLossPercent.Value := Form1.edLossCount.value / (Form1.edWinCount.value + Form1.edLossCount.value) * 100;
end;

procedure Form1_edWinCount_OnChange (Sender: string);
begin
    CalculateTotal;
end;

procedure Form1_edLossCount_OnChange (Sender: string);
begin
    CalculateTotal;
end;

The script below doesn't  work when added second calc. I've tried adding variables but couldn't get it working?

procedure CalculateTotal;
var
  WinPercent, LossPercent: Real;
  WinPercent2, LossPercent2: Real;

begin
  WinPercent:= Form1.edWinPercent.value;
  LossPercent:= Form1.edLossPercent.Value;
  WinPercent2:= Form1.edWinPercent2.value;
  LossPercent2:= Form1.edLossPercent2.Value;

    begin
    Form1.edWinPercent.Value := Form1.edWinCount.value / (Form1.edWinCount.value + Form1.edLossCount.value) * 100;
    Form1.edLossPercent.Value := Form1.edLossCount.value / (Form1.edWinCount.value + Form1.edLossCount.value) * 100;

    Form1.edWinPercent2.Value := Form1.edWinCount2.value / (Form1.edWinCount2.value + Form1.edLossCount2.value) * 100;
    Form1.edLossPercent2.Value := Form1.edLossCount2.value / (Form1.edWinCount2.value + Form1.edLossCount2.value) * 100;
    end;
end;

procedure Form1_edWinCount_OnChange (Sender: string);
begin
    CalculateTotal;
end;

procedure Form1_edLossCount_OnChange (Sender: string);
begin
    CalculateTotal;
end;


procedure Form1_edWinCount2_OnChange (Sender: string);
begin
    CalculateTotal;
end;

procedure Form1_edLossCount2_OnChange (Sender: string);
begin
    CalculateTotal;
end;

It may sound silly as to why I need more than one calc of same; on a same page but I needed. Each calc applies to different items on a same page.


Please see the attached sample project if needed:

739

(48 replies, posted in General)

Hi EHW,


Thank you very much...................


Your approach is much better than mine. Taking out repeating fields to group header makes reading clearer and easier. Nice one..... Appreciated.......

740

(48 replies, posted in General)

I'm having reports blues again......


This time I'm trying to create a report for "SaleTransHist"
On "SaleTransHist" repeating values are hidden or replaced with value zero for easier reading and avoiding incorrect sums on tGrid footer.
Unfortunately, fast reports gets repeating values, therefore having duplicates and wrong sums in the report.
I tried workaround by copying column tGrid footer values those applying to per invoice not InvItem (Discount, Delivery and Inv Totals) but couldn't get those values displayed in fast reports?


Please see images below for additional reference:
https://s31.postimg.org/8zpb6s5bv/zzz_Test.png
https://s8.postimg.org/foq9uobvp/zzz_Test2.png


Sample is project attached. FR file "SalesTransHist.fr3" in the reports folder:

741

(6 replies, posted in General)

Hi bemorhona-qt,


Yes, indeed your script does work..
Mistake was at my end, I have applied it to wrong form partially.


Thank you so much for your kind help..........

742

(6 replies, posted in General)

bemorhona-qt wrote:

Solution for 1 section:
procedure frmCustomer_Button1_OnAfterClick (Sender: string);
begin
      Form1.tgSearch_Customers.dbItemID:= Last_Insert_id;
      Form1_tgSearch_Customers_OnCellClick('',0,0);
end;

Solution for 2 section:
procedure Form1_Button8_OnAfterClick (Sender: string);
var
i: integer;
begin
      i:= Form1.tgSearch_Customers.RowCount;
      Form1.tgSearch_Customers.SelectedRow:= i-1;
      Form1_tgSearch_Customers_OnCellClick('',0,0);
end;

Solution for 3 section is same as 1.


Tanks a lot bemorhona-qt....
It doesn't work at my end "not enough actual parameters..."
does it work at your end with the sample project posted on first post of this thread?

743

(6 replies, posted in General)

- When added new record I like to see tGrid focusing on newly added record and showing it's details on details section.
- When deleted an existing record  I like to see tGrid focusing on previous available records and showing it's details on details section.
- When edited (via button or double click) an existing record I like to see tGrid focusing on edited record and showing it's details on details section.
without the need of clicking on the record in tGrid.


Are these possible?


Please see the attached sample project to show if the items above are possible:

744

(22 replies, posted in General)

Great stuff EHW........
Thank you so much............................

745

(22 replies, posted in General)

Thx EHW,


You're right, there is an error on pasted script. That has been corrected in "Search in ComboBox 5b (v3.21b and higher).zip " sample project.


Still not possible to do a search with and.
For instance If I want to search in combo for A Ba to find all names starting with A and surnames starting with BA. combo stops (showing nothing) after pressing space bar and then typing anything else after pressing space bar doesn't make any difference.


Currently, it's doing searching  name OR surname fine. I was hoping to add to OR search AND search as well as described above and my post #15.

746

(22 replies, posted in General)

DriveSoft wrote:

AD1408
Please attach your project.


Hi Dmitry,


Please see the attached sample project.
I was trying to apply search in combo (invoice form) as described on my post #15

747

(22 replies, posted in General)

Thx a lot Dmitry...........................


I've tested MVD v 3.21beta but it didn't work at my end.


For instance, on groups combo typing J and hitting space clears combo list then typing more after space doesn't make any difference.


You have applied to on form1 groups combo. I tried to apply same script with some edit to frmInvoice combo and it didn't accept any any input?

procedure frmInvoice_cbCustomer_OnKeyPress (Sender: string; var Key: Char);
var
    id: integer;
    ar: array of string;

begin

    if ord(Key)= 13 then
    begin
        id := frmInvoice.cbCustomer.dbItemID;
        frmInvoice.cbCustomer.DroppedDown:=False;
        frmInvoice.cbCustomer.dbItemID := id;
        Key := #0;
        Exit;
    end;

    if ord(Key)= 8 then // for backspace button
    begin
        s_cbCustomer := '';
        frmInvoice.cbCustomer.Text := '';
        frmInvoice.cbCustomer.dbUpdate; //UpdateDatabase('person');
        Key := #0;
        frmInvoice.cbCustomer.DroppedDown:=False;
        frmInvoice.cbCustomer.dbItemID := -1;
        Exit;
    end;

    s_cbCustomer := s_cbCustomer + Key;
    Key := #0;

    ar := SplitString(s_cbCustomer, ' ');
    if (Length(ar)=2) and (ar[1]<>'') then
    frmInvoice.cbCustomer.dbFilter := '(firstname LIKE '''+ ar[0] +'%'') AND (lastname LIKE '''+ar[1]+'%'')'
    else
        frmInvoice.cbCustomer.dbFilter := '(lastname LIKE ''%'+ s_cbCustomer +'%'''+')';

    frmInvoice.cbCustomer.dbUpdate;
    frmInvoice.cbCustomer.DroppedDown:=True;
    frmInvoice.cbCustomer.Text := s_cbGroups;
    frmInvoice.cbCustomer.SelStart := Length(s_cbCustomer);

end;



procedure frmInvoice_cbCustomer_OnCloseUp (Sender: string);
var
    id: integer;

begin

    id := frmInvoice.cbCustomer.dbItemID;
    frmInvoice.cbCustomer.dbFilter := '';
    frmInvoice.cbCustomer.dbUpdate; //UpdateDatabase('person');
    frmInvoice.cbCustomer.dbItemID := id;
    s_cbCustomer := '';
end; 

748

(22 replies, posted in General)

Thank you sooooooo much Dmitry for the update and revised sample project.......................


Name or Surname search works fine now.


Taking it little further, what about if I want to use name and surname as a search term?
For instance:
1. If I type Amy and Ba in combo (space between Amy and Ba) it'd find;
Amy Baker
Amy Bailey
Amy Ball
Amy Bancroft
.....


2. If I type J and Ba in combo (space between J and Ba) it'd find;
Jon Baker
John Bailey
John Baker
James Ball
Jack Bancroft
Jack Baker
Jack Ball
.......

749

(2 replies, posted in General)

I asked the similar question not so long ago.


Check out Password thread which may help.
http://myvisualdatabase.com/forum/viewtopic.php?id=3005

750

(22 replies, posted in General)

Hi EHW,


Thanks a lot for the correction......
However, with that correction combo on inv form lets me enter only one letter at my end?


----------
Edit:

Sorry EHW. I was testing it with MVD 3.1x. It works fine with MVD 2.7
Need an update for search in combo script so that it works with MVD 3.1x
I have to use MVD 3.1x as I'm using some tGrid display filtering which only works on MVD 3.1x