Quote:
quote:Originally posted by damnnono_86
me.recordsource = "Select table1.name,table1.ID,table1.address from table1 where table1.name = forms!table1!txtID;"
me.requery
|
Ohhhhhh... you're not checking to see if there is data in your table; what you're trying to do is
filter the data to show only one subset of data from your entire table.
You can leave the record source alone as Table1 and just put this on txtID's AfterUpdate event:
Code:
Me.FilterOn = True
Me.Filter = "[name] = '" & Me.txtID & "'"
If there is no data, the form will come up empty. That's evidence enough, you don't need a message! And when you want to reset the form to ALL data (use a button), you can use this on the button's OnClick event:
By the way, be careful with statements like this:
Code:
me.recordsource = "Select table1.name,table1.ID, _
table1.address from table1 where table1.name = forms!table1!txtID;"
Be sure to separate out the variables from the strings. It should be written like this:
Code:
me.recordsource = "Select table1.name,table1.ID, _
table1.address from table1 where _
table1.name = '" & forms!table1!txtID & "';"
Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division