Romio_1968
Member
- Local time
- , 01:13
- Joined
- Jan 11, 2023
- Messages
- 126
Hello,
I have an Continuous subform linked to the following Query
The controls on subform are linked to the above query fields.
Loading fine, works fine, all except 3 unbound textbox controls
There are 3 controls that are taking value from correspondin query fields, called ClassCode1, ClassCode2, ClassCode3.
All three are calculated fields in the Query
The 3 unbound textbox (Domain1, Domain2, Domain3) controls are suppose to take value based on ClassCode1, ClassCode2, ClassCode3.
I used the Form_OnLoad event to do this, using the following code:
Usin this, the first record was ok, including the Domain1-3 controls, but when navigating form the subform Nav.Bar to the next record, the values inside Domain1-3 controls are not updated, shwing the values for the first record, up to the end.
I tryed to use the same code not in Form_OnLoad event, but in Form_Current.
Now looks quite good. The values of the 3 textboxes are updated for each record, but... if I try to navigate trough records using the vertical scrol bar, again I see no updated values.
Any Ideea why?
I may have a workarround using the query itself, by creating an agregated field and then breaking it apart, but I think that maybe there is something simpler out there.
Thank You
I have an Continuous subform linked to the following Query
Code:
SELECT Titles.Title_ID,
Titles.Title,
SQLConcatenate("SELECT Author.Author_Name
FROM Author
INNER JOIN TAJunction ON Author.Author_ID = TAJunction.Author_IDFK
WHERE TAJunction.Title_IDFK = " & [Titles].[Title_ID],", ") AS AuthorNames,
Titles.Timestamp,
Titles.Publisher,
Titles.PublishPlace,
Titles.PrintYear,
Titles.Media,
SQLConcatenate("SELECT ClassCode
FROM TDJunction
WHERE Title_IDFK = " & [Titles].[Title_ID],", ") AS ClassCodes,
SQLConcatenate("SELECT Inventory_No
FROM Inventory
WHERE Title_IDFK = " & [Titles].[Title_ID],", ") AS InventoryNumbers,
[ClassCode1] AS Cota,
IIf(InStr([ClassCodes],";")=0,Trim([ClassCodes]),Trim(Left(Trim([ClassCodes]),InStr(Trim([ClassCodes]),";")-1))) AS ClassCode1,
IIf(InStr([ClassCodes],";")=0,"",IIf(InStr(Mid([ClassCodes],InStr([ClassCodes],";")+1),";")=0,Trim(Mid([ClassCodes],InStr([ClassCodes],";")+1)),Trim(Left(Trim(Mid([ClassCodes],InStr([ClassCodes],";")+1)),InStr(Trim(Mid([ClassCodes],InStr([ClassCodes],";")+1)),";")-1)))) AS ClassCode2,
Trim(IIf(InStr([ClassCodes],";")=0,"",IIf(InStr(Mid([ClassCodes],InStr([ClassCodes],";")+1),";")=0,"",Mid(Mid([ClassCodes],InStr([ClassCodes],";")+1),InStr(Mid([ClassCodes],InStr([ClassCodes],";")+1),";")+1)))) AS ClassCode3
FROM Titles;
The controls on subform are linked to the above query fields.
Loading fine, works fine, all except 3 unbound textbox controls
There are 3 controls that are taking value from correspondin query fields, called ClassCode1, ClassCode2, ClassCode3.
All three are calculated fields in the Query
The 3 unbound textbox (Domain1, Domain2, Domain3) controls are suppose to take value based on ClassCode1, ClassCode2, ClassCode3.
I used the Form_OnLoad event to do this, using the following code:
Code:
Private Sub Form_Load()
' ClassCode1 - Domain1
Me.Domain1 = DLookup("Domain", "Domains", "ClassCode = '" & Me.ClassCode1 & "'")
' ClassCode2 - Domain2
Me.Domain2 = DLookup("Domain", "Domains", "ClassCode = '" & Me.ClassCode2 & "'")
' ClassCode3 - Domain3
Me.Domain3 = DLookup("Domain", "Domains", "ClassCode = '" & Me.ClassCode3 & "'")
End Sub
Usin this, the first record was ok, including the Domain1-3 controls, but when navigating form the subform Nav.Bar to the next record, the values inside Domain1-3 controls are not updated, shwing the values for the first record, up to the end.
I tryed to use the same code not in Form_OnLoad event, but in Form_Current.
Now looks quite good. The values of the 3 textboxes are updated for each record, but... if I try to navigate trough records using the vertical scrol bar, again I see no updated values.
Any Ideea why?
I may have a workarround using the query itself, by creating an agregated field and then breaking it apart, but I think that maybe there is something simpler out there.
Thank You