I have a small form with four controls, each bound to a field in a table.
The table has various fields holding publicly available information as well as the four fields that hold private information. This all on a single record.
To access the private info requires a double click on a particular control or click the "New" button.
Regardless of what record I select, the secondary form opens with info in the first non-null record. This happens to be the second record in the table.
The form itself is bound to the common table.
The code for the form is:
The calling code is:
Public boolean isNew flags a new record.
The table has various fields holding publicly available information as well as the four fields that hold private information. This all on a single record.
To access the private info requires a double click on a particular control or click the "New" button.
Regardless of what record I select, the secondary form opens with info in the first non-null record. This happens to be the second record in the table.
The form itself is bound to the common table.
The code for the form is:
Code:
Option Compare Database
Option Explicit
Private Sub btnNoInfo_Click()
isNew = False
DoCmd.Close acForm, Me.Name
End Sub
Private Sub Form_Load()
If isNew = True Then
Me.btnClose.Visible = False
Me.btnNoInfo.Visible = True
Else
Me.btnClose.Visible = True
Me.btnNoInfo.Visible = False
End If
End Sub
Code:
Private Sub BtnNew_Click()
isNew = True
DoCmd.Close acForm, "nok"
Me.Dirty = False
Call locker(False)
DoCmd.GoToRecord , , acNewRec
Call show("Please enter data in all relevant fields", "Y", 2)
Me.txtNameInit.SetFocus
End Sub
Public boolean isNew flags a new record.