![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
This all works - nearly. I can open the form at the record I require and can then navigate the other records. But the textbox bound to DateModified now shows #Error. If I remove that sorting field from the recordsource then it displays ok. It's obviously the sorting that screws things up (but I need it sorted). Is there a quick fix? |
#3
| |||
| |||
|
|
I'm opening a form like so; strWhere = "[id] = " & lngRpt DoCmd.openform "frmCC_Choice", , , , , acDialog, "usercodes" The form opens and I run this form in the open event 'Dao code courtesy of Allen Browne in 2006 Dim rs As DAO.Recordset With Forms!frmCC_Choice Set rs = .RecordsetClone rs.FindFirst strWhere If rs.NoMatch Then MsgBox "Not found" Else .Bookmark = rs.Bookmark End If End With Set rs = Nothing Me.RecordSource = "SELECT report_defs.*, report_defs.Type, report_defs.DateModified FROM report_defs WHERE (((report_defs.Type) =" & "'C'" & ")) ORDER BY report_defs.DateModified DESC;" This all works - nearly. I can open the form at the record I require and can then navigate the other records. But the textbox bound to DateModified now shows #Error. If I remove that sorting field from the recordsource then it displays ok. It's obviously the sorting that screws things up (but I need it sorted). Is there a quick fix? Your statement |
#4
| |||
| |||
|
|
buckskin wrote: I'm opening a form like so; strWhere = "[id] = " & lngRpt DoCmd.openform "frmCC_Choice", , , , , acDialog, "usercodes" The form opens and I run this form in the open event 'Dao code courtesy of Allen Browne in 2006 Dim rs As DAO.Recordset With Forms!frmCC_Choice Set rs = .RecordsetClone rs.FindFirst strWhere If rs.NoMatch Then MsgBox "Not found" Else .Bookmark = rs.Bookmark End If End With Set rs = Nothing Me.RecordSource = "SELECT report_defs.*, report_defs.Type, report_defs.DateModified FROM report_defs WHERE (((report_defs.Type) =" & "'C'" & ")) ORDER BY report_defs.DateModified DESC;" This all works - nearly. I can open the form at the record I require and can then navigate the other records. But the textbox bound to DateModified now shows #Error. If I remove that sorting field from the recordsource then it displays ok. It's obviously the sorting that screws things up (but I need it sorted). Is there a quick fix? Your statement Me.RecordSource = "SELECT report_defs.*, report_defs.Type, report_defs.DateModified FROM report_defs Why do you select Type and DateModified again. They should already be selected in report_defs.*. |
|
Why are you setting the bookmark prior to code for finding the record? |
| |
#5
| |||
| |||
|
| Your statement Me.RecordSource = "SELECT report_defs.*, report_defs.Type, report_defs.DateModified FROM report_defs Why do you select Type and DateModified again. They should already be selected in report_defs.*. Why are you setting the bookmark prior to code for finding the record? |
#6
| |||
| |||
|
|
"Salad" <salad (AT) oilandvinegar (DOT) com> wrote in message news:kZqdnSwP97MBswjQnZ2dnUVZ_gidnZ2d (AT) earthlink (DOT) com... buckskin wrote: I'm opening a form like so; strWhere = "[id] = " & lngRpt DoCmd.openform "frmCC_Choice", , , , , acDialog, "usercodes" The form opens and I run this form in the open event 'Dao code courtesy of Allen Browne in 2006 Dim rs As DAO.Recordset With Forms!frmCC_Choice Set rs = .RecordsetClone rs.FindFirst strWhere If rs.NoMatch Then MsgBox "Not found" Else .Bookmark = rs.Bookmark End If End With Set rs = Nothing Me.RecordSource = "SELECT report_defs.*, report_defs.Type, report_defs.DateModified FROM report_defs WHERE (((report_defs.Type) =" & "'C'" & ")) ORDER BY report_defs.DateModified DESC;" This all works - nearly. I can open the form at the record I require and can then navigate the other records. But the textbox bound to DateModified now shows #Error. If I remove that sorting field from the recordsource then it displays ok. It's obviously the sorting that screws things up (but I need it sorted). Is there a quick fix? Your statement Me.RecordSource = "SELECT report_defs.*, report_defs.Type, report_defs.DateModified FROM report_defs Why do you select Type and DateModified again. They should already be selected in report_defs.*. Ah good point. Why are you setting the bookmark prior to code for finding the record? Hmmm, the perils of copy/pasting code without understanding what it is. OK so I should set the recordsource first then set the bookmark? |
![]() |
| Thread Tools | |
| Display Modes | |
| |