Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display pop up message in a subform based on combo box

Status
Not open for further replies.

teachmecr

Programmer
Oct 1, 2006
72
0
0
US
Hi All,
I have a main form leaseinfo and then a subform called leaseinfosubform and i have 2 combos on the main form as comp_num and lease_num(depedent on comp_num combox). The subform has several fields including comp_num and lease_num and its placed on the main form and shows data based upon the comp_num and lease_num combos. What i want to do is if a user types in a lease_num which doesn't correspond to the the right comp_num the subform should not return anything which is working fine now but i wana be able to give them a some kind of pop up saying the lease_num doesn't belong to the comp_num selected. Or if for a particular comp_num and lease_num there's no info i wana be able to give them a pop saying "No Info". Any kinda help would be appreicated. thanks

Below is my code:

Private Sub cmb_LeaseNum_AfterUpdate()
Form![dbo_AccessLPlusLeaseVW subform].Requery
End Sub
 
You should be able to limit the contents of the lease combo to show only relevant records:

faq702-4289

Pop-up messages can be annoying after a while, but if you wish to provide one you can check the RecordCount property of the Recordset. For example:

Code:
Private Sub cmb_LeaseNum_AfterUpdate()
'I am not sure why this works:
    Form![dbo_AccessLPlusLeaseVW subform].Requery
'Check count
    If Me.[dbo_AccessLPlusLeaseVW subform].Forms.Recordset.RecordCount=0 Then
       MsgBox "No Info"
    End If

End Sub[/code]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top