>Mark,
>Does the condition that would determine modality exist prior to the form launch or is determined after the fact?
>
>If it exists, then you can check for the condition in the Load or Init or the form and set the WindowType accordingly. If not, I haven't found a clean way of doing this. Focus shifts to the second form briefly before returning to the first form and I haven't come up with a clean work around for this.
No, the form can already exist. What I am doing is allowing the user to add anew record using the same edit form. So if the form is already open, I do any updates on the views, set my view parameter to zero and requery to get an empty view. I then append blank. At this point, the user must either cancel the add or save it.
The cleanest code I have come up with goes in the form Deactivate:
with This
if .lAddMode
if empty(.Tag)
.Tag = "NOMSG"
.Show()
MessageBox('Complete or cancel the new record.', ;
MB_ICONEXCLAMATION, "Warning...")
else
.Tag = ""
.Show()
endif
else
DoDefault()
endif
endwith
Since I am using a messagbox, I have to fire the SHOW() twice because the deactivate is firing twice [once because of the msgbox]. Since I do not want the MsgBox to fire twice, I have theMsgBox in only one place.
To make this more clear, the other [First] form is a list of selected records that the user is selecting from to edit. The KeyID of the selected record is passed to the second form via an oApp property. The second form uses that KeyId as the view parameter. If the KeyID is ZERO, this triggers a new record in the second form.
Mark McCasland
Midlothian, TX USA