Hi all!
I am trying to look up a value, if it is there the database will open that record. I am then trying to add some fields to that record based on a subform. I would like the user to go straight from the "lookup" box directly to where they should enter info into the subform. The only problem is Access keeps telling me that there is no such field on the current form. This is my code. I am pretty new to vba, so bear with me.
The error that comes up is "Run-time Error '2109': There is no field named 'Me!FrmSubRevAdd!RevNumber' in the current record"
I have tried entering as "Forms!FrmDwgData!FrmSubRevAdd!RevNumber" with no luck either. If I try to move focus to a field on the main form it works. Any ideas what I am doing wrong?
Thanks in advance!!
I am trying to look up a value, if it is there the database will open that record. I am then trying to add some fields to that record based on a subform. I would like the user to go straight from the "lookup" box directly to where they should enter info into the subform. The only problem is Access keeps telling me that there is no such field on the current form. This is my code. I am pretty new to vba, so bear with me.
Code:
Private Sub PartNumberLookup_AfterUpdate()
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.FindFirst "PartNumber = """ & PartNumberLookup & """"
'If rs.NoMatch is false, then go to record
'Else If rs.NoMatch is true, then go to new record
If (Not rs.NoMatch) Then
Me.Recordset.Bookmark = Me.RecordsetClone.Bookmark
DoCmd.GoToControl "Me!FrmSubRevAdd!RevNumber"
Else
DoCmd.GoToRecord , , acNewRec
strPartNumberLookup = PartNumberLookup
PartNumber = PartNumberLookup
End If
End Sub
The error that comes up is "Run-time Error '2109': There is no field named 'Me!FrmSubRevAdd!RevNumber' in the current record"
I have tried entering as "Forms!FrmDwgData!FrmSubRevAdd!RevNumber" with no luck either. If I try to move focus to a field on the main form it works. Any ideas what I am doing wrong?
Thanks in advance!!