J
James D Smooth
I've got 3 unbound combo boxes on my form that are used to narrow
down
and find results in a couple of tables that are used in an Insert
Process. The combo boxes work as expected except when cycling through
records they do not show the values that should be associated. I've
tried using the Form_Current function in order to populate the values
when the record in shown, but for some reason it only works for 1 of
the 3 combo boxes (Licensor). I've attached the Form_Current Logic
that I've currently got in place. Any help would be greatly
appreciated, I'm sure it's something that I'm overlooking, but after
2
days of playing with this code I still can't seem to figure out what
I've missed.
Private Sub Form_Current()
Dim LIC_ID As Integer
Dim strSQL As String
Dim AccessDB As DAO.Database
Dim tmpQry As QueryDef
Dim rst As DAO.Recordset
Set AccessDB = CurrentDb()
LIC_ID = IsNull(Me.LIC_ID)
If LIC_ID = False Then
strSQL = "SELECT DISTINCT lic.RLTY_CD, lic.LICENSOR,
apc.ACCT_PROF_DESC FROM ACCT_PROF AS apc INNER JOIN LICENSES AS lic
ON
apc.ACCT_ID = lic.ACCT_ID WHERE lic.HISTORIC = 0 AND lic.LIC_ID = " &
Me!LIC_ID
Set tmpQry = AccessDB.CreateQueryDef("Update Combo", strSQL)
Set rst = AccessDB.OpenRecordset("Update Combo", dbOpenDynaset,
dbSeeChanges)
DoCmd.DeleteObject acQuery, "Update Combo"
Me.cmb_Rlty_Cd = rst!RLTY_CD
Me.cmbLicensor = rst!LICENSOR
Me.cmbAcctProf = rst!acct_prof_desc
Me.cmb_Rlty_Cd.RowSource = "SELECT DISTINCT RLTY_CD FROM LICENSES
WHERE HISTORIC = 0 AND LIC_ID = " & Me!LIC_ID
Else
Me.cmb_Rlty_Cd.RowSource = "SELECT DISTINCT RLTY_CD FROM LICENSES
WHERE HISTORIC = 0 ORDER BY RLTY_CD"
cmb_Rlty_Cd = Null
cmbLicensor = Null
cmbAcctProf = Null
End If
Me!cmb_Rlty_Cd.Requery
Me!cmbLicensor.Requery
Me!cmbAcctProf.Requery
End Sub
down
and find results in a couple of tables that are used in an Insert
Process. The combo boxes work as expected except when cycling through
records they do not show the values that should be associated. I've
tried using the Form_Current function in order to populate the values
when the record in shown, but for some reason it only works for 1 of
the 3 combo boxes (Licensor). I've attached the Form_Current Logic
that I've currently got in place. Any help would be greatly
appreciated, I'm sure it's something that I'm overlooking, but after
2
days of playing with this code I still can't seem to figure out what
I've missed.
Private Sub Form_Current()
Dim LIC_ID As Integer
Dim strSQL As String
Dim AccessDB As DAO.Database
Dim tmpQry As QueryDef
Dim rst As DAO.Recordset
Set AccessDB = CurrentDb()
LIC_ID = IsNull(Me.LIC_ID)
If LIC_ID = False Then
strSQL = "SELECT DISTINCT lic.RLTY_CD, lic.LICENSOR,
apc.ACCT_PROF_DESC FROM ACCT_PROF AS apc INNER JOIN LICENSES AS lic
ON
apc.ACCT_ID = lic.ACCT_ID WHERE lic.HISTORIC = 0 AND lic.LIC_ID = " &
Me!LIC_ID
Set tmpQry = AccessDB.CreateQueryDef("Update Combo", strSQL)
Set rst = AccessDB.OpenRecordset("Update Combo", dbOpenDynaset,
dbSeeChanges)
DoCmd.DeleteObject acQuery, "Update Combo"
Me.cmb_Rlty_Cd = rst!RLTY_CD
Me.cmbLicensor = rst!LICENSOR
Me.cmbAcctProf = rst!acct_prof_desc
Me.cmb_Rlty_Cd.RowSource = "SELECT DISTINCT RLTY_CD FROM LICENSES
WHERE HISTORIC = 0 AND LIC_ID = " & Me!LIC_ID
Else
Me.cmb_Rlty_Cd.RowSource = "SELECT DISTINCT RLTY_CD FROM LICENSES
WHERE HISTORIC = 0 ORDER BY RLTY_CD"
cmb_Rlty_Cd = Null
cmbLicensor = Null
cmbAcctProf = Null
End If
Me!cmb_Rlty_Cd.Requery
Me!cmbLicensor.Requery
Me!cmbAcctProf.Requery
End Sub