Originally Posted by
ryan1313
You need to delete the control source under the combo box's properties. You can still set the row source to lookup the site values that you want.
If a control is bound to a field in a table, the value shown is the value for that field that is stored for that current record. So when you are changing that combo box trying to filter your form, you are actually trying to change the value stored in the table.
By having it unbound, it is just that. It is not bound to any record in a table, therefore you can change its value without it affecting your record.
Edited to Add:
I have uploaded a simple example of using a combobox to lookup info from a table on a form.
Thanks for sharing that file. I unbounded the 4 tables in the database. Is there a way to mass DLookup information? I have about 50 fields in one of the forms and I would rather not copy paste 50 lines of DLookup queries if I can avoid it.
I noticed you used this code instead of DLookup:
Code:
Dim strSQL As String
strSQL = "SELECT * FROM tblMain WHERE [SiteID] = " & Me.cbositeLookup
Me.Form.RecordSource = strSQL
It's been a while since I've taken any classes involving programming languages, so I'm not sure how to decipher this except that tblMain is the table and you set the condition to match whatever the chosen SiteID is. But from looking at your attached file, it would appear that I can use this as an alternative to DLookup, no?