T
Terry Holland
Im still looking for a solution to this problem. The only response I had to
previous thread did not solve the problem
tia
Terry
Its been a while since I did any work on Access so bear with me.
I have a continuous form (frmPSUA_List) that has the following query as its
recordsource
=======================
SELECT drawingdata.drawingname, [Product name] & " - " & [title] AS Product,
drawingdata.[Universal code] AS [Stock Code], drawingdata.[Drawn by],
drawingdata.Date, tblProductSafeUseAnalysis.psua_lng_id
FROM drawingdata LEFT JOIN tblProductSafeUseAnalysis ON
drawingdata.drawingname = tblProductSafeUseAnalysis.psua_drda_DrawingNumber
WHERE (((drawingdata.drawingname) Like "d*" Or (drawingdata.drawingname)
Like "p*") AND
((drawingdata.Date)>[Forms]![frmProductSafeUseAnalysis]![txtDateFilter]))
ORDER BY drawingdata.Date
WITH OWNERACCESS OPTION;
=======================
On my form I have a button that opens an instance of another form (frmPSUA)
that is used to populate a record in the table tblProductSafeUseAnalysis.
When the user clicks OK on this form they return to frmPSUA_List. I want to
have this screen refreshed so that the textbox that displays the value for
tblProductSafeUseAnalysis.psua_lng_id does in fact show the id for the newly
created record AND the focus remains on this record.
I thought the refreshing would have been a simple Me.Requery but this seems
to have no effect. If I manually type Shift+F9, that value appears. With
this in mind I thought I'd try a SendKeys ("+{f9}") and this refreshes the
record but focus moves to first record.
I then thought that if I recorded the bookmark of the current record before
doing my processing and then set bookmark back to this after, that would
solve my problem but with the following code Im not having any success
=============================
Private Sub cmdPSUA_Click()
Dim frm As New Form_frmPSUA
Dim varBookmark As Variant
varBookmark = Me.Bookmark
With frm
.DrawingNumber = Me.txtdrawingname
.StockCode = Nz(Me.txtStockCode)
.Modal = True
.Visible = True
While .Visible
DoEvents
Wend
If Not .Cancelled Then
Me.txtStockCode = .StockCode
SendKeys ("+{F9}")
Me.Bookmark = varBookmark
End If
End With
End Sub
=============================
The code above does refresh my textbox but focus moves to top record. If I
include a True parameter on my SendKeys call, the focus does move to the
correct record, but that textbox is not refreshed.
Ive tried a similar thing using AbsolutePosition and GoToRecord but this has
not work either.
Any suggestions?
Terry Holland
previous thread did not solve the problem
tia
Terry
Its been a while since I did any work on Access so bear with me.
I have a continuous form (frmPSUA_List) that has the following query as its
recordsource
=======================
SELECT drawingdata.drawingname, [Product name] & " - " & [title] AS Product,
drawingdata.[Universal code] AS [Stock Code], drawingdata.[Drawn by],
drawingdata.Date, tblProductSafeUseAnalysis.psua_lng_id
FROM drawingdata LEFT JOIN tblProductSafeUseAnalysis ON
drawingdata.drawingname = tblProductSafeUseAnalysis.psua_drda_DrawingNumber
WHERE (((drawingdata.drawingname) Like "d*" Or (drawingdata.drawingname)
Like "p*") AND
((drawingdata.Date)>[Forms]![frmProductSafeUseAnalysis]![txtDateFilter]))
ORDER BY drawingdata.Date
WITH OWNERACCESS OPTION;
=======================
On my form I have a button that opens an instance of another form (frmPSUA)
that is used to populate a record in the table tblProductSafeUseAnalysis.
When the user clicks OK on this form they return to frmPSUA_List. I want to
have this screen refreshed so that the textbox that displays the value for
tblProductSafeUseAnalysis.psua_lng_id does in fact show the id for the newly
created record AND the focus remains on this record.
I thought the refreshing would have been a simple Me.Requery but this seems
to have no effect. If I manually type Shift+F9, that value appears. With
this in mind I thought I'd try a SendKeys ("+{f9}") and this refreshes the
record but focus moves to first record.
I then thought that if I recorded the bookmark of the current record before
doing my processing and then set bookmark back to this after, that would
solve my problem but with the following code Im not having any success
=============================
Private Sub cmdPSUA_Click()
Dim frm As New Form_frmPSUA
Dim varBookmark As Variant
varBookmark = Me.Bookmark
With frm
.DrawingNumber = Me.txtdrawingname
.StockCode = Nz(Me.txtStockCode)
.Modal = True
.Visible = True
While .Visible
DoEvents
Wend
If Not .Cancelled Then
Me.txtStockCode = .StockCode
SendKeys ("+{F9}")
Me.Bookmark = varBookmark
End If
End With
End Sub
=============================
The code above does refresh my textbox but focus moves to top record. If I
include a True parameter on my SendKeys call, the focus does move to the
correct record, but that textbox is not refreshed.
Ive tried a similar thing using AbsolutePosition and GoToRecord but this has
not work either.
Any suggestions?
Terry Holland