new value in record selector goto

M

Marco

How can i go with a button to a specific record ?
I have a form with subform, and if a change the value in subform record
selector, i desire with a button (instead of enter) to go the enter value
or i put the value in a testbox and go to record in subform.

thx
 
A

Arvin Meyer [MVP]

Every bound form, including subforms, have a recordsource of a table or
query. Build a recordet on that same query and do a FindFirst. Something
like:

With Me.RecordsetClone
.FindFirst "[SomeField] >= """ & Me.MyTextBox & "*"""
If .NoMatch Then
MsgBox "Not found", vbOKOny, "No such record"
Else
Me.Bookmark = .Bookmark
End If
End With

--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 
M

Marco

Private Sub Command18_Click()
On Error GoTo Err_Command18_Click

With Me.RecordsetClone
.FindFirst "[ID] >= " & Me.Text19
If .NoMatch Then
MsgBox "Not found"
Else
Me.Bookmark = .Bookmark
End If
End With

Exit_Command18_Click:
Exit Sub

Err_Command18_Click:
MsgBox Err.Description
Resume Exit_Command18_Click

End Sub

this works only in a forms on my table, but i have a subform: tblTest
subform on form Test
error is
you entered an expression that has an invalid reference to the recorsetclone
property

"Arvin Meyer [MVP]" wrote
Every bound form, including subforms, have a recordsource of a table or
query. Build a recordet on that same query and do a FindFirst. Something
like:

With Me.RecordsetClone
.FindFirst "[SomeField] >= """ & Me.MyTextBox & "*"""
If .NoMatch Then
MsgBox "Not found", vbOKOny, "No such record"
Else
Me.Bookmark = .Bookmark
End If
End With

--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

Marco said:
How can i go with a button to a specific record ?
I have a form with subform, and if a change the value in subform record
selector, i desire with a button (instead of enter) to go the enter
value
or i put the value in a testbox and go to record in subform.

thx
 
A

Arvin Meyer [MVP]

For a subform, you need to it change to:

With Me.[SubformName].Form.RecordsetClone
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

Marco said:
Private Sub Command18_Click()
On Error GoTo Err_Command18_Click

With Me.RecordsetClone
.FindFirst "[ID] >= " & Me.Text19
If .NoMatch Then
MsgBox "Not found"
Else
Me.Bookmark = .Bookmark
End If
End With

Exit_Command18_Click:
Exit Sub

Err_Command18_Click:
MsgBox Err.Description
Resume Exit_Command18_Click

End Sub

this works only in a forms on my table, but i have a subform: tblTest
subform on form Test
error is
you entered an expression that has an invalid reference to the recorsetclone
property

"Arvin Meyer [MVP]" wrote
Every bound form, including subforms, have a recordsource of a table or
query. Build a recordet on that same query and do a FindFirst. Something
like:

With Me.RecordsetClone
.FindFirst "[SomeField] >= """ & Me.MyTextBox & "*"""
If .NoMatch Then
MsgBox "Not found", vbOKOny, "No such record"
Else
Me.Bookmark = .Bookmark
End If
End With

--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

Marco said:
How can i go with a button to a specific record ?
I have a form with subform, and if a change the value in subform record
selector, i desire with a button (instead of enter) to go the enter
value
or i put the value in a testbox and go to record in subform.

thx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top