so this is odd. I have ensured the recordsource is updateable. This was working prior, but who knows what of the 89097987 attempts I've made at getting this all to work, that was. I have a form for records. The detail is visible = false on load. The header shows with buttons to look up a record (pop-up form), add a new record (pop-up form), and go back to main menu. The add record needs a pop-up form, so that the user can choose a "contact" and/or "match", as the hierachy of relationships is Contact --> Match --> Record. I have the code below, to execute a stored procedure, which will add the new record and bring back the scope identity, so I can use that in setting a 1 record - record source on the main records form, when I return to it.
This all works fine, except when I am returned back to the records form, on this 1 record, the form is locked. I can't click on anything. The access ribbon has the views grayed out. When I right-click the title bar of the form, then everything is ok again, but I have no idea what that means. Why is my form frozen? Why can't I work in the form, now that I have a record source of the new record I've added? The form is set to allow edits, and the fields are not locked. I can't click on the different pages of a tab control on the form either. I am happy to debug different properties, but not sure which ones might be the culprit. Why does right-clicking the form's title bar unlock everything so it works again?
Here is the add new record code on the pop-up form:
Any help would be greatly appreciated!
Thank you.
misscrf
It is never too late to become what you could have been ~ George Eliot
This all works fine, except when I am returned back to the records form, on this 1 record, the form is locked. I can't click on anything. The access ribbon has the views grayed out. When I right-click the title bar of the form, then everything is ok again, but I have no idea what that means. Why is my form frozen? Why can't I work in the form, now that I have a record source of the new record I've added? The form is set to allow edits, and the fields are not locked. I can't click on the different pages of a tab control on the form either. I am happy to debug different properties, but not sure which ones might be the culprit. Why does right-clicking the form's title bar unlock everything so it works again?
Here is the add new record code on the pop-up form:
Code:
Private Sub cmdStartNewMRecord_Click()
Dim mid As Integer
Dim cmd As New ADODB.Command
Dim midparm As New ADODB.Parameter
Dim MCID As New ADODB.Parameter
Dim frmMCSQL As String
If Nz(Me.cboChooseContact.Column(0), 0) = 0 Then
MsgBox "No Contact has been selected. Records must be assigned to a valid Contact and Match.", vbCritical, "Must Choose a Contact and Match to Continue."
ElseIf Nz(Me.cboChooseMatch.Column(0), 0) = 0 Then
MsgBox "No Contact has been selected. Records must be assigned to a valid Contact and Match.", vbCritical, "Must Choose a Contact and Match to Continue."
Else
mid = Nz(Me.cboChooseMatch.Column(0), 0)
With cmd
.CommandText = "sp_AddNewMatchRecord"
.CommandType = adCmdStoredProc
.ActiveConnection = "DRIVER={SQL Server};SERVER=blahservername;DATABASE=blahdatabasename"
Set midparm = .CreateParameter("@mid", adVarChar, adParamInput, 30, mid)
.Parameters.Append midparm
Set MCID = .CreateParameter("@NEWID", adCurrency, adParamOutput)
.Parameters.Append MCID
.Execute Options:=adExecuteNoRecords
Set .ActiveConnection = Nothing
Set midparm = Nothing
End With
Debug.Print MCID
End If
frmMCSQL = "SELECT * FROM tblMRecords WHERE ID = " & MCID
Forms!frmMRecords.RecordSource = frmMCSQL
Forms!frmMRecords.Visible = True
Forms!frmMRecords.Detail.Visible = True
Forms!frmMRecords.Refresh
Call ShowRequirements(Nz(MCID, 0))
Set MCID = Nothing
Set cmd = Nothing
DoCmd.Close acForm, "frmMRecords_AddNewRecord", acSaveNo
End Sub
Any help would be greatly appreciated!
Thank you.
misscrf
It is never too late to become what you could have been ~ George Eliot