So I have a form with subforms, where the main form's source is a table called tblCharts. Within this table there is a field called ID that is autonumbered.
So I created a combo box that's row source is a query that selects the ID field from table charts and two other descriptive fields to make navigation easier. Limit List is set to yes.
The problem comes up with code that I've used multiple times, but not with an autonumber. The code typicallly looks like this when I'm searching on a text field.
This worked at first but then 3070 runtime error came up, the form started messing up. So I made this code
This code worked at first, so I decided to make a copy of my form called Copy Of frmCharts. After this the code stopped working on the initial frmCharts but now works on the copy.
I'm not sure why this happened, any tips about the code, or any idea of what is going on?
I posted a similar question a while back but this is a different database and running in MS 2013
Edit: I also received other errors besides 2070. I know what error 3070 is but I can't figure out why it's not working on this form. I closed and opened the form a few times and it happened to start working. Very frustrating when I'm trying to make the system reliable for others to use
Edit2: The code only seems to do this when I enter design view then switch back to form view
So I created a combo box that's row source is a query that selects the ID field from table charts and two other descriptive fields to make navigation easier. Limit List is set to yes.
The problem comes up with code that I've used multiple times, but not with an autonumber. The code typicallly looks like this when I'm searching on a text field.
Code:
Sub cboPatientSelection_AfterUpdate ()
Dim rs As DAO.Recordset
If Not IsNull(Me.cboPatientSelection) Then
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[tblCharts].[ID] = """ & Me.cboPatientSelection & """"
If rs.NoMatch Then
MsgBox "Not found. Perhaps the file is filtered; Remove all filters before proceeding"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub
This worked at first but then 3070 runtime error came up, the form started messing up. So I made this code
Code:
Sub cboPatientSelection_AfterUpdate ()
Dim rs As DAO.Recordset
If Not IsNull(Me.cboPatientSelection) Then
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[tblCharts].[ID] = " & Me.[cboPatientSelection] & ""
If rs.NoMatch Then
MsgBox "Not found. Perhaps the file is filtered; Remove all filters before proceeding"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub
This code worked at first, so I decided to make a copy of my form called Copy Of frmCharts. After this the code stopped working on the initial frmCharts but now works on the copy.
I'm not sure why this happened, any tips about the code, or any idea of what is going on?
I posted a similar question a while back but this is a different database and running in MS 2013
Edit: I also received other errors besides 2070. I know what error 3070 is but I can't figure out why it's not working on this form. I closed and opened the form a few times and it happened to start working. Very frustrating when I'm trying to make the system reliable for others to use
Edit2: The code only seems to do this when I enter design view then switch back to form view
Last edited: