How to save a MS Access filtered table as a query in VBA -


i need able save results of filtered table in microsoft access(2010) query. reports in access dynamic if based off of query. if based reports off of table itself, wouldn't save of search terms/filter results. in access macro builder, docmd.save saves current table, need able "save as" in vba can save filtered table query.

thanks

you need build sql statement based on filter , orderby settings of form.

dim ssql string  ssql = "select ... mytable"  if len(me.filter) > 0     ssql = ssql & " " & me.filter end if  if len(me.orderby) > 0     ssql = ssql & " order " & me.orderby end if  call dbengine.workspaces(0).databases(0).createquerydef("myqueryname", ssql) 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -