morglum007
Registered User.
- Local time
- Today, 13:56
- Joined
- Sep 28, 2009
- Messages
- 26
From listbox to data sheet form... rowsource to recordsource (solved)
Good day,
Here I am again with the eternal problem of search forms.
Well, as I could not solve the listbox problems due access limitations, I decided to change "query" to a data sheet form, and use the listbox as a "preview" of what the user is searching.
I have a form, called "General form", in which there are three cascading comboboxes. First select all database tables, second one all fields in such choosen table and third one, values you want to be filtered in such field.
The result is a "search" statement in listbox that will show specified data.
First combobox is named "elementscb", second one "fieldcb", and third one is "finalchoosecb", saving data in tempvars format to allow form exchanging without loosing such variables.
Final statement in listbox (named "searchlist") is working fine:
Once there, I decided to try showing such data in a datasheet in order to avoid listbox limitations, and made another form (which I set as continuous form) named "Results". There is a "View details" command button that will launch this form.
I have set the next in results open event:
I am getting the correct values, but I think I am not using the correct statement for data sheet source, because I always get a "blank" data sheet with no data.
I have changed this statement many times in many ways, but no luck yet.
Any ideas???
Thank you so much. I really appreciate any reply.
Morg
Good day,
Here I am again with the eternal problem of search forms.
Well, as I could not solve the listbox problems due access limitations, I decided to change "query" to a data sheet form, and use the listbox as a "preview" of what the user is searching.
I have a form, called "General form", in which there are three cascading comboboxes. First select all database tables, second one all fields in such choosen table and third one, values you want to be filtered in such field.
The result is a "search" statement in listbox that will show specified data.
First combobox is named "elementscb", second one "fieldcb", and third one is "finalchoosecb", saving data in tempvars format to allow form exchanging without loosing such variables.
Final statement in listbox (named "searchlist") is working fine:
Code:
Me.Searchlist.RowSource = "SELECT " & elementscb & ".* FROM [" & elementscb & "] WHERE [" & fieldcb & "] = finalchoosecb.text"
Once there, I decided to try showing such data in a datasheet in order to avoid listbox limitations, and made another form (which I set as continuous form) named "Results". There is a "View details" command button that will launch this form.
I have set the next in results open event:
Code:
Private Sub Form_Open(Cancel As Integer)
elementscb = TempVars("elementscb")
fieldcb = TempVars("fieldcb")
finalchoosecb = TempVars("finalchoosecb")
MsgBox elementscb
MsgBox fieldcb
MsgBox finalchoosecb
Me.Form.RecordSource = "SELECT DISTINCT [" & elementscb & "]![" & fieldcb & "] FROM [" & elementscb & "] WHERE [" & fieldcb & "] like'" & finalchoosecb & "'"
I am getting the correct values, but I think I am not using the correct statement for data sheet source, because I always get a "blank" data sheet with no data.
I have changed this statement many times in many ways, but no luck yet.
Any ideas???
Thank you so much. I really appreciate any reply.
Morg
Last edited: