Hi. Anytime you call a routine with a non-optional argument, you will have to provide a value for the argument.Great! I've got
but getting error Argument not optionalCode:call Form_mysubform.Prefix_DblClick
Should I expect something else ?
You may have to modify the routine to get the value from a variable. Otherwise, make the current prefix is the one you want first.Thanks, found I had to add (vbcancel),
However now I need to select the record in that Form. I know the value of the 'Prefix' field.
Is there any VBA command to do this ? That is I know there must be but I can't think what.
Seems way too complicated. Any thoughts ? ThanksCode:Sub GotoRecord(ByVal strPrefix As String) Dim rst As DAO.Recordset Dim strff As String Set rst =Form_mysubform.Form.RecordsetClone strff = "Prefix = '" & strPrefix & "'" rst.FindFirst strff If Not rst.NoMatch Then Form_mysubform.Form.Bookmark = rst.Bookmark End If rst.Close Set rst = Nothing End Sub
Actually, I think there is (or was it a two -liner?), but I think you're better off with what you got....looks liket here's no one-liner (which was probably what I was hoping for).
The recordsetclone method is a leftover from before the recordset property of a form was accessible.Gives a useful quick overview.
By complicated I meant using a recordset clone and bookmark just to goto a record. I imagined something much simpler
like DoCmd.GotoRecord(Prefix=123) might exist.
Yes, I mis-spoke. I had in mind finding "First" or finding "Last" which usually trips people up because the names First and Last are misleading.Aren't I using .FindFirst anyway
You mentioned the long code using the recordsetclone and not the shorter recordset method that I posted. I believe the recordset clone and bookmark method that you see on the internet is a leftover from the days when you could not get the actual recordset. You had to do it the long way.But I'm not sure what you were telling me about leftover property. And the comments saying what I had was okay or best.
Is there some issue I might run into with me.recordset.FindFirst "Prefix = 123". I like it.