Herr Lukas wrote:
hello
I'm from germany
- 1 form bounded at 1 tableI with IDaqi and IDarbG, ok, it' works.
- the form is kind endless, not surprising
- in the detail-section I want to built 1 listbox
its rowsource type query with select * from query23
where IDaqi=aqiID
(the main-key from query23 its tableII and tableIII)
surprising
zero results
when I cut the WhereCondition, all! recordsets show all! value
but
not surprising
any hint for constructing?!
It would be very nice for some example_access_databases?!
Thanks a lot!
Dear all Kurt Lukas, Germany, Saarbrücken like a river and a bridge
select * from query23 where IDaqi=aqiID
Is aqiID the current ID on the form? If so, you need to tell the query
where to get the value of aqiID. Let's say the form is called Main.
Then the query should work with
select * from query23 where IDaqi=Forms!Main!aqiID
If you were to create a dynamic SQL statement, you might enter
Dim strSQL as String
Dim rst As Recordset
strSQL = "select * from query23 where IDaqi = " & Me.aqiID
set rst = Currentdb.Openrecordset(strSQL,dbopendynaset)
Next, when you go to a new record, you may need to requery the listbox.
Let's say the Listbox name is ListBox0. In the OnCurrent event for
the form (since it is bound), enter
Me.Listbox0.Requery
I am not sure why anyone would want a listbox filtered to one record.
Just an observation.
Another, why use Query23? That is about as informative as nothing. I
recommend that you click on Query23 and then rightclick and rename it to
something relevent. Then right click on it, select Properties, and
enter something like
Called in form Main. Used in Listbox.
as you now have a reference to it and the name is informative. Then
rebuild the rowsource for the listbox using the queries new name instead
of Query23.