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!

Problem displaying formatted text in DBEdit

Status
Not open for further replies.

topcat01

Programmer
Jul 10, 2003
83
GB
Evening,

I am working with D7 with SQL Server 2005, a form with DBNavigator and some DBEdit boxes.

I would like one of the DBedit boxes to display the new reference number when the insert button is pressed on the dbnavigator (increments after each new record 000124, 000125 and so on). I have used the following line of code to ensure the format of the reference remains consistent:

Code:
Temp:=Format('%.6d', NewIssue);   // this works ok

However when the insert button is pressed the new issue number is displayed as ‘124’ in the DBedit. I have tried the following:

Code:
frmMain.DBEdit1.Text := Temp;

Code:
IssueTable.FieldByName('IssueNo').AsString := Temp;

Neither option seems to work. The format string is working (tested with showmessage) but I am doing something wrong after that. I have called the above in the Event 'BeforePost' from ADOTable.

As ever any pointers in the right direction would be welcome!
 
Looks like you need something like a DBMaskEdit control. A Google search should probably get you one quickly.

HTH
TonHu
 
Thanks, the following code worked fine:

Code:
if Sender.IsNull then
    Text := Format('%.6d', [NextIssue.FieldByName('NewIssue').AsInteger])
  else
    Text := Sender.AsString;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top