P
placek
Hello
I'm hoping someone can show me the error of my ways. I'm
pretty inexperienced in VBA and i hope one of you guys can
push me in the right direction.
TblBorrowerRelation has two fields: lngBorrowerNumberCnt
and strBorrowerName. QryBorrowerRelation is based on
tblBorrowerRelation.
Form5 contains a text box, command button and subform. The
subform is based on qryBorrowerRelation. The user inputs a
Borrower Number in the text box and clicks the command
button. The event handler for the command button updates
qryBorrowerRelation. The code is as follows.
Private Sub Command0_Click()
Dim dbDatabase As Database
Dim qdfQueryDef As QueryDef
Dim varText_Box As Variant
varText_Box = Text5.Value
Set dbDatabase = DBEngine(0)(0)
Set qdfQueryDef = dbDatabase.QueryDefs
("qryBorrowerRelation")
qdfQueryDef.SQL = "select * from tblBorrowerRelation where
tblBorrowerRelation.lngBorrowerNumberCnt=" & varText_Box
End Sub
The problem is that the sub form does not update after the
command button is clicked. The only way i can get the sub
form to update is by going into design view and then
returning to form view. How can i get the sub form to
update after the command button is clicked (without having
to return to design view)? Any help is much appreciated.
Martin
I'm hoping someone can show me the error of my ways. I'm
pretty inexperienced in VBA and i hope one of you guys can
push me in the right direction.
TblBorrowerRelation has two fields: lngBorrowerNumberCnt
and strBorrowerName. QryBorrowerRelation is based on
tblBorrowerRelation.
Form5 contains a text box, command button and subform. The
subform is based on qryBorrowerRelation. The user inputs a
Borrower Number in the text box and clicks the command
button. The event handler for the command button updates
qryBorrowerRelation. The code is as follows.
Private Sub Command0_Click()
Dim dbDatabase As Database
Dim qdfQueryDef As QueryDef
Dim varText_Box As Variant
varText_Box = Text5.Value
Set dbDatabase = DBEngine(0)(0)
Set qdfQueryDef = dbDatabase.QueryDefs
("qryBorrowerRelation")
qdfQueryDef.SQL = "select * from tblBorrowerRelation where
tblBorrowerRelation.lngBorrowerNumberCnt=" & varText_Box
End Sub
The problem is that the sub form does not update after the
command button is clicked. The only way i can get the sub
form to update is by going into design view and then
returning to form view. How can i get the sub form to
update after the command button is clicked (without having
to return to design view)? Any help is much appreciated.
Martin