Save Changes dialog on close after changing textbox format "on Open"

J

jsantamaria1611

I have a table that contains all he info required to setup the Record
Source, Control labels, textboxes and format.

The Search form that is used to Search records from different tables

subform contains 10 textbox controls (txtF01...txtF10)

OnOpen of the main form, I set the ControlSource and the Format for
each of the Textbox controls using the following code

Private Sub Form_Open(Cancel As Integer)
On Error GoTo error_Form_Open

Dim dbs As DAO.Database
Dim rFind As DAO.Recordset
Dim strQry as String, strFindSQL as String

strName = Forms!frmFind.OpenArgs
strFindSQL = "SELECT * FROM tblFind WHERE FindName = """ & strName
& """"

Set rFind = dbs.OpenRecordset(strFindSQL, dbOpenDynaset,
dbSeeChanges)

With Me.fsubFind.Form
.RecordSource = strQry

.txtField1.Format = Nz(rFind.F1Format, "")
.txtField2.Format = Nz(rFind.F2Format, "")
.txtField3.Format = Nz(rFindF3Format, "")

.txtField1.ControlSource = Nz(rFind.F1Field, "")
.txtField2.ControlSource = Nz(rFind.F2Field, "")
.txtField3.ControlSource = Nz(rFind.F3Field, "")

End With
....

End Sub

Private Sub cmdClose_Click()
DoCmd.Close acForm, "frmSMFind", acSaveNo
End Sub

Since converting from Access 2000 to Access 2007, I always get a
dialog box asking to Save Changes to the subform fsubFind when I click
on the Close button of the form.

Thanks.

Regards
Joe Santamaria
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top