subform

  • Thread starter alxw3 via AccessMonster.com
  • Start date
A

alxw3 via AccessMonster.com

I have a problem and not sure of a way to fix it. I have a sub form in a form.
When form loads, its subform displays the old query records not the current
embedded query.
 
M

Mr B

alxw3,

Idealy any sub form is linked to the main form via at least one common field
so that when the main form loads the sub form will display just those records
that relate to the currently display record in the main form.

Do you have your sub form linked to the main form?
 
J

John W. Vinson

I have a problem and not sure of a way to fix it. I have a sub form in a form.
When form loads, its subform displays the old query records not the current
embedded query.

What is the "current embedded query"? What is the Recordsource of the
mainform? of the subform? What are the subform's Master/Child Link Fields?

More info please - we can't see your screen!
 
A

alxw3 via AccessMonster.com

parent form is not linked to subform.
subform's embedded query is based on a date. in parent form, date field is
set and query is done.
embedded query is set to original after each new query in the parent. When
parent form is closed an re-opened , same old query result is shown. not the
result form the original embedded query.
 
J

John W. Vinson

parent form is not linked to subform.
subform's embedded query is based on a date. in parent form, date field is
set and query is done.
embedded query is set to original after each new query in the parent. When
parent form is closed an re-opened , same old query result is shown. not the
result form the original embedded query.

Please post your code. We can't tell what's wrong when we can't see the
queries or how they're being run.
 
A

alxw3 via AccessMonster.com

well, there is not much to it. It might a bug in the access itself. embedded
myquery in the access queries:
SELECT TrackByID.PID, Person_Info.FirstName, Person_Info.Age, Person_Info.
Height, Person_Info.Exam, Person_Info.[Exam Date], Person_Info.Score
FROM TrackByID INNER JOIN Person_Info ON (TrackByID.Height=Person_Info.Height)
AND
(TrackByID.Age=Person_Info.Age) AND (TrackByID.FirstName=Person_Info.
FirstName)
GROUP BY TrackByID.PID, Person_Info.FirstName, Person_Info.Age, Person_Info.
Height, Person_Info.Exam, Person_Info.[Exam Date], Person_Info.Score
HAVING (((Person_Info.[Exam Date])<Date()))
ORDER BY Person_Info.[Exam Date];

similar to this nice example:
dbSearchExample.zip
http://www.access-programmers.co.uk/forums/showthread.php?t=129855
i noticed sometimes, this zip project has the same issue eventhough...
 
J

John W. Vinson

well, there is not much to it. It might a bug in the access itself. embedded
myquery in the access queries:
SELECT TrackByID.PID, Person_Info.FirstName, Person_Info.Age, Person_Info.
Height, Person_Info.Exam, Person_Info.[Exam Date], Person_Info.Score
FROM TrackByID INNER JOIN Person_Info ON (TrackByID.Height=Person_Info.Height)
AND
(TrackByID.Age=Person_Info.Age) AND (TrackByID.FirstName=Person_Info.
FirstName)
GROUP BY TrackByID.PID, Person_Info.FirstName, Person_Info.Age, Person_Info.
Height, Person_Info.Exam, Person_Info.[Exam Date], Person_Info.Score
HAVING (((Person_Info.[Exam Date])<Date()))
ORDER BY Person_Info.[Exam Date];

similar to this nice example:
dbSearchExample.zip
http://www.access-programmers.co.uk/forums/showthread.php?t=129855
i noticed sometimes, this zip project has the same issue eventhough...

I've read the sentence "embedded myquery in the access queries" three or four
times and it has me completely baffled.

You have not, as requested, posted the Recordsource queries of the two forms,
or the code that you're apparently running.

I'd love to help but...
 
A

alxw3 via AccessMonster.com

i think i figure it out. for now seems to be working. your replies inspired
me.
well, there is not much to it. It might a bug in the access itself. embedded
myquery in the access queries:
[quoted text clipped - 13 lines]
http://www.access-programmers.co.uk/forums/showthread.php?t=129855
i noticed sometimes, this zip project has the same issue eventhough...

I've read the sentence "embedded myquery in the access queries" three or four
times and it has me completely baffled.

You have not, as requested, posted the Recordsource queries of the two forms,
or the code that you're apparently running.

I'd love to help but...
 
A

alxw3 via AccessMonster.com

still, there is still something wrong. i do not know how upload .mdb file.
anyway, there are two tables:

Person_Info table:
name text
age Number
Height Number
exme date date/time
score number

TrackByID table:
PID Number
name text
age number
height number
date date/time

this is my query:
Query1:
SELECT TrackByID.PID, Person_Info.name, Person_Info.Age, Person_Info.Height,
Person_Info.[Exam Date], Person_Info.Score FROM TrackByID INNER JOIN
Person_Info ON (TrackByID.name = Person_Info.name) AND (TrackByID.Age =
Person_Info.Age) AND
(TrackByID.Height = Person_Info.Height) GROUP BY TrackByID.PID, Person_Info.
name, Person_Info.Age, Person_Info.Height, Person_Info.[Exam Date],
Person_Info.Score
HAVING (((Person_Info.[Exam Date])=Date()));

created sub form , subfrm_Query1.
parent form: there are unbound text box, "date", on parent form and a click
on button.
parent is linked to sub form, subfrm_Query1.

Option Compare Database

Private Sub Command0_Click()
Dim strsql As String
strsql = "SELECT TrackByID.PID, Person_Info.name, Person_Info.Age, " & _
"Person_Info.Height, Person_Info.[Exam Date], Person_Info.
Score " & _
"FROM TrackByID INNER JOIN Person_Info ON (TrackByID.Height
= " & _
"Person_Info.Height) AND (TrackByID.Age = Person_Info.Age)
AND " & _
"(TrackByID.name = Person_Info.name) GROUP BY TrackByID.PID,
" & _
"Person_Info.name, Person_Info.Age, Person_Info.Height, " &
_
"Person_Info.[Exam Date], Person_Info.Score " & _
"HAVING (Person_Info.[Exam Date]<= #" & Format(Me![date],
"mm/dd/yyyy") & "#);"

Me.subfrm_Query1.Form.RecordSource = strsql
Me.subfrm_Query1.Requery
End Sub

that is it. nothing else to it.
when i open subform by itself, i see no record. but, i open parent form i see
old records displayed.
you can duplicate it using these info.

i think i figure it out. for now seems to be working. your replies inspired
me.
[quoted text clipped - 9 lines]
I'd love to help but...
 
Top