I'm working on an access form that contains a combo box and other controls.
When I click on button, it calls a subroutine that builds a table that
populates the combo box. Works great, but the form goes away. When I open
it up, the box looks good, but The form HAS to stay visible. Is there a setting
that I need to set to keep this from happen. Please advise.
Private Sub Command18_Click()
Load_Contract_Table
End Sub
Public Sub Load_Contract_Table()
Dim daDb As DAO.Database
Dim rst1 As Recordset
Dim rst2 As Recordset
Dim selContract As String
Set daDb = CurrentDb
Set rst1 = daDb.OpenRecordset("tblContracts")
Set rst2 = daDb.OpenRecordset("tblContractList")
Dim svContract As String
Dim svID As Integer
Dim newCont As String
Set daDb = CurrentDb
svContract = " "
st1.MoveFirst
Do Until rst1.EOF
If rst1!Contract <> svContract Then
MsgBox "Contract= " & rst1!Contract
svContract = rst1!Contract
svID = rst1!ID
newCont = rst1!Contract
AddCon newCont, svID
End If
rst1.MoveNext
Loop
End Sub
Public Sub AddCon(newCont, svID)
Dim daDb As DAO.Database
Dim rst1 As Recordset
Dim rst2 As Recordset
Dim selContract As String
Set daDb = CurrentDb
Set rst1 = daDb.OpenRecordset("tblContracts")
Set rst2 = daDb.OpenRecordset("tblContractList")
rst2.AddNew
rst2!Contract = newCont
rst2!ID = svID
rst2.Update
rst2.Close
Set rst2 = Nothing
DoCmd.Close
End Sub
question from:
https://stackoverflow.com/questions/65925333/disappearing-form 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…