Originally Posted by
carmenv323
I have a form that opens in datasheet view and allows the user to select options from dropdowns in some of the fields.
When I use the form on its own the dropdowns can be selected, however, on once it's in the Navigation form, the dropdowns drop down but I can't make a selection.
What is missing?
It looks like the form(s) have the "Allow Additions", "Allow Deletions", "Allow Edits" and "Allow Filters" set to No. See Form " Property sheet/ Data Tab".
When the Main Navigation Form opens, there is code that explicitly sets the Edit mode to False (Allow Edits = No)
Code:
'Main Navigation Form - Should always be first open
bEditMode = False
Then, (I used the form "frmOtherActiveAssignments") when the form "frmOtherActiveAssignments" opens, the Form_Load event fires:
Code:
Private Sub Form_Load()
Me.AllowEdits = bEditMode '<<-- forces Allow Edits to be False/No
Me.AllowDeletions = False
Me.AllowAdditions = False
Select Case intAccess
Case 0, -1
'readonly (directors view)
'TODO format for directors view
Case 1, 2
Case 3
Case 4
Me.AllowAdditions = True
End Select
End Sub
To Edit a field, the "Allow Edits" property for the form MUST be set to Yes. So, in the upper right hand corner of the form is a button, "Edit Mode is Off". Clicking that button changes the caption of the button to "Edit Mode is On". You can now edit the combo boxes. Clicking the Edit Mode button again locks/prevents changing the combo box ("Edit Mode is Off").
Code:
Private Sub btnEditMode_Click()
On Error GoTo ErrorHandler
Dim obj As Object
If bEditMode = False Then
bEditMode = True
Me.NavigationSubform.Form.AllowEdits = True
Me.btnEditMode.Caption = "Edit Mode: On"
'For Each obj In Me.NavigationSubform.Form
' obj.AllowEdits = True
' Next
Else
bEditMode = False
Me.NavigationSubform.Form.AllowEdits = False
Me.btnEditMode.Caption = "Edit Mode: Off"
'For Each obj In Me.NavigationSubform.Form
' obj.AllowEdits = False
' Next
End If
Exit Sub
ErrorHandler:
Exit Sub
End Sub
================================================== =========================
--------------------------- Things I noticed ------------------------------------------------------
The top two lines of EVERY module should be:
Code:
Option Compare Database
Option Explicit
After adding "Option Explicit" to every module and compiling the code, there will be many errors. Most are undeclared variables. One error is a misspelled parameter in a function.
In MODULE1, there is a function
Code:
Public Function getValueFromPopUp(formName As String, PopUpControlNae As String, Optional MyOpenArgs As String = "None") As Variant
This parameter name should be "PopUpControlName"
There are a LOT of Look-up FIELDS in the tables. Most developers do not use Look-up FIELDS (Bad),different from Look-up TABLES (Good).
See The evils of lookup fields
----------------------------------------------------------------------------------------------------------------
The structure of these tables should be looked at. They have repeating fields....
tbl_EstimateLog
tbl_MultipleRequests
tbl_Requests
tbl_WSBActuals
These tables have spaces/special characters in field names
tbl_VoltClass
tbl_ProjectSvc
tbl_OtherAssignments
I saw a lot of tables with a PK field name of "ID". I would rename the ID field to something more descriptive...... (I never use ID).