Hi guy,
this is another core question.
While I can't handle with OLE error on this link
I decided to use new method that I think possible way to get my work done.
first I create listbox contain multi value that I want to select
then I use this code act like a call-value function
then input callcriteria() in query's criteria.
after that, I open form, choose 1, 2, or 3 values as the same time. Then I open the query.
I got the error like this title question "Run-time error '-246500594 (800f000e)': method 'item' object 'Forms' failed"
people usually use querydef to make query temp from sql containt where condition which value selected from listbox.
but I don't think that way, I think might be we can call directly that value into criteria of query rowsource object
but I got new error after call directly on form rowsource object "Unknow Access database engine error" ==
Help me guy, I'm too excited to solve these problem :3
Thank in advantage, give me a hand :3
this is another core question.
While I can't handle with OLE error on this link
I decided to use new method that I think possible way to get my work done.
first I create listbox contain multi value that I want to select
then I use this code act like a call-value function
Code:
Public Function CallCriteria() As String Dim Criteria As String Dim i As Variant ' Build criteria string from selected items in list box. Criteria = "" With Forms![export data]![List1394] For i = 0 To .ListCount - 1 If .Selected(i) Then Criteria = Criteria & .Column(0, i) & ", " Next i End With '/Wrap the In() command around the string Criteria = "In " & "(" & Criteria & ")" ' Filter the form using selected items in the list box. CallCriteria = Criteria End Function
after that, I open form, choose 1, 2, or 3 values as the same time. Then I open the query.
I got the error like this title question "Run-time error '-246500594 (800f000e)': method 'item' object 'Forms' failed"
people usually use querydef to make query temp from sql containt where condition which value selected from listbox.
but I don't think that way, I think might be we can call directly that value into criteria of query rowsource object
but I got new error after call directly on form rowsource object "Unknow Access database engine error" ==
Help me guy, I'm too excited to solve these problem :3
Thank in advantage, give me a hand :3
Comment