Originally Posted by
Micron
I have to wonder if you're over complicating this. ...
That may be. I don't think I'm using an append to open a new record, I'm using DoCmd.RunCommand acCmdRecordsGoToNew on the Form_Open event to create a new record. Does that count as an append?
I just checked to be sure, I am using Option Explicit on this and all of the sister forms. The sister forms are for different departments to update their relevant fields.
I am querying other tables in this form but not necessarily on the open event. Rather, a text box is bound to a function called getSpec().
This is the relevant part of my Form_Open event:
Code:
If Nz(Me.OpenArgs) = 0 Then
'set a toggle variable for additions
Me.AllowAdditions = True
Me.RecordSource = "LOT_DATES"
DoCmd.RunCommand acCmdRecordsGoToNew
Me.LOT_NUMBER.Locked = False
Me.SPEC_NUM.Locked = False
GoTo skipLocks
Else
Me.RecordSource = "Select LOT_DATES.* FROM LOT_DATES WHERE (((LOT_DATES.LOT_NUMBER)='" & Me.OpenArgs & "'));"
End If
getSpec():
Code:
Private Function getSpec()
If Nz(Me.OpenArgs) = 0 Then
getSpec = "0"
Else
getSpec = DLookup("[SPEC_DESC]", "SPEC_DATA", "[SPEC_NUM] = LOT_DATES.SPEC_NUM")
End If
End Function
EDIT: If you're saying that I may have a corrupt form or control, I can probably re-create this form from one of the sister forms pretty easily to make them all work the same way again. I was recently weighing the merits of making all of the functions and variables in these forms global, since they are very similar forms but I think doing that may have caused bigger problems. I'm going to mark this as solved and go with rebuilding from a sister form.
EDIT2: This started when I made a recent update, which I started a separate thread on last week. This update involved adding a new button with new functionality, and a new field in the LOT_DATES table. But when I created this new button, rather than using a fresh control from the design menu, I copy and pasted an existing button then changed the names and events to what I needed. I wonder if that caused the corruption, and if making that change with a fresh button might fix this whole mess.