Skip to forum content
My Visual Database
A Simple Solution for Creating Databases
You are not logged in. Please login or register.
Active topics Unanswered topics
Search options
derek wrote:Hi Jason,
You need another 'begin.....end' after your 'else' because you have more than one instruction in that condition.
If you have just 'else' (without a 'begin.....end'), it will conditionally execute the first instruction but then unconditionally execute the second (which is why it is always closing frmcolours)
Please see the attached.
Derek.
Awesome - thank you for your assistance
Good morning,
I have a MessageDlg as per the code below - however, when the user clicks cancel (mrNo) the form still closes. Please what am I doing wrong??
procedure frmColours_btnClose_OnClick (Sender: TObject; var Cancel: boolean);
begin
if frmColours.edColourID.GetTextLen > 0 then
begin
if MessageDlg('Are you sure you wish to discard your changes? '+frmColours.edColourID.text, mtConfirmation,mbNo+mbYes,0) = mrNo
//if mrNo
then // Cancel pressed
begin
ShowMessage('Dont Close (testing procedure)');
frmColours.edColourID.SetFocus;
end
else
ShowMessage('Closing (testing procedure)'); // Yes pressed
frmColours.Close;
end;
end;
Thank you everyone for your replies, with our assistance i have resolved the issue.
Hi there, we are writing a database where one of our tables contains Colours.
The first column is a four digit Colour key i.e BLAC for Black. If a user tries to add BLAC for a new record how do we check if it already exists and if it does advise the user if already exists?
We need the four digit key to be unique to avoid multiple entries of the same.
Thank you
Jason
Posts found: 4