By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,356 Members | 2,752 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,356 IT Pros & Developers. It's quick & easy.

show all records in my subform

P: 1
hi all,
i'm a new programmer...
i use a combo box to filtering the records in my sub form..it was works...but when i want to show all records in my sub form it doesnt works..how it would be?please help me. thx..

private sub combo2_afterupdate()
dim rs as object
if not isnull(me.combo2) then
if me.dirty then
me.dirty = false
end if
set rs = me.recordsetclone
rs.findfirst "[field1] = '" & Me![combo] & "'"
if me![combo] = "ALL" ---> i'll make this item as an icon to show all records
???---> wat should i fill to this part, so i can show all records in my form
else
me.bookmark = rs.bookmark
end if
set rs = nothing
end if
end sub
Jun 13 '07 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 344
hi all,
i'm a new programmer...
i use a combo box to filtering the records in my sub form..it was works...but when i want to show all records in my sub form it doesnt works..how it would be?please help me. thx..

private sub combo2_afterupdate()
dim rs as object
if not isnull(me.combo2) then
if me.dirty then
me.dirty = false
end if
set rs = me.recordsetclone
rs.findfirst "[field1] = '" & Me![combo] & "'"
if me![combo] = "ALL" ---> i'll make this item as an icon to show all records
???---> wat should i fill to this part, so i can show all records in my form
else
me.bookmark = rs.bookmark
end if
set rs = nothing
end if
end sub
The way I do this is to make the combo box a union query, e.g.
Expand|Select|Wrap|Line Numbers
  1. SELECT tblMandal.Mandal_ID, tblMandal.MandalName FROM tblMandal ORDER BY tblMandal.MandalName  union select 0,"<All>" from tblMandal;
  2.  
and then in the after_update event of the combo box
Expand|Select|Wrap|Line Numbers
  1. If cboMandal = 0 Then
  2.     Me.FilterOn = False
  3. Else
  4.     DoCmd.ApplyFilter , "Mandal_ID=" & cboMandal
  5. End If
  6.  
In this case, Mandal is an area in a country, like a US state or UK county, and the form is showing towns and villages, filtered by Mandal
Jun 13 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.