Unanswered: Open a Form without showing first record
I want to open a form, which having a record source...and i want that when i open the form ...it just show the blank form...like "Add New record'...only display data when user select when of the combobox's value...
you can specify filter when you open your form, so specify record, which does not exist or better specify few records ....
Docmd.openform "frmMyForm", "SELECT * FROM myTable WHERE myID = 111111111"
+ you can create simple function which changes LOCKED=NO to LOCKED=YES and vice versa for all fields in any form... so when user opens the form, everything is locked and he can see only one record and needs to unlock it (click a button or select something from combo). I had app, where most of the users wanted to see the data and sometimes they wanted to update something... lock/unlock feature prevented tons of errors.
this is very simple sub for lock/unlock (allowdelete, edit and append) for all fields in the form and one level subforms.... you can improve it.... I did it few years ago.
simply after you pick something from combo run
ChangeAccessRights "frmMyFrom", True, True, True
Public Sub ChangeAccessRights(InputForm As String, AllowEdit As Boolean, AllowDel As Boolean, AllowAdd As Boolean)
Dim MyControl As Control
On Error Resume Next
If IsLoaded(InputForm) Then
For Each MyControl In Forms(InputForm).Controls
If MyControl.ControlType = acSubform Then
MyControl.Form.AllowEdits = AllowEdit
MyControl.Form.AllowAdditions = AllowAdd
MyControl.Form.AllowDeletions = AllowDel
Forms(InputForm).AllowEdits = AllowEdit
Forms(InputForm).AllowAdditions = AllowAdd
Forms(InputForm).AllowDeletions = AllowDel
Function IsLoaded(ByVal strFormName As String) As Integer
' Returns True if the specified form is open in Form view or Datasheet view.