Using "Find" in locked or disabled fields?

G

Guest

I have a statement form that contains an autonumber field for the statement
number. I want this field to be disabled or locked so that users don't go
into it, but I would like to be able to use Find within this field to search
for a specific statement number. How can I do this?

Thanks so much!

Sandra G
 
A

Allen Browne

If you want to use the Find dialog to search the particular field, you will
need to leave its Enabled property to Yes. You can set Locked to No if you
wish. Set TabStop to No so that the user doesn't go there when tabbing
through the controls on the form if that helps.

The alternative would be to add an unbound control to the form, so the user
can type a number there, and press Enter to find the record without ever
needing to open the Find dialog. Use the AfterUpdate event of this text box
to FindFirst in the RecordsetClone of the form, and if found jump to that
record.

The event procedure would look something like this:

Sub txtGoTo_AfterUpdate ()
Dim rs As DAO.Recordset

If Not IsNull(Me.txtGoTo) Then
'Save before move.
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[CustomerID] = " & Me.txtGoTo
If rs.NoMatch Then
MsgBox "Not found"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
news:[email protected]...
 
D

Dirk Goldgar

Allen Browne said:
If you want to use the Find dialog to search the particular field,
you will need to leave its Enabled property to Yes. You can set
Locked to No if you wish.

I think Allen meant "set Locked to Yes if you wish".
 
G

Guest

Ah ha, yes I see. Thanks a million-
SLG

Allen Browne said:
If you want to use the Find dialog to search the particular field, you will
need to leave its Enabled property to Yes. You can set Locked to No if you
wish. Set TabStop to No so that the user doesn't go there when tabbing
through the controls on the form if that helps.

The alternative would be to add an unbound control to the form, so the user
can type a number there, and press Enter to find the record without ever
needing to open the Find dialog. Use the AfterUpdate event of this text box
to FindFirst in the RecordsetClone of the form, and if found jump to that
record.

The event procedure would look something like this:

Sub txtGoTo_AfterUpdate ()
Dim rs As DAO.Recordset

If Not IsNull(Me.txtGoTo) Then
'Save before move.
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[CustomerID] = " & Me.txtGoTo
If rs.NoMatch Then
MsgBox "Not found"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
I have a statement form that contains an autonumber field for the statement
number. I want this field to be disabled or locked so that users don't go
into it, but I would like to be able to use Find within this field to
search
for a specific statement number. How can I do this?

Thanks so much!

Sandra G
 
G

Guest

I hate to sound really stupid, but how do you "rate" the replies? I can't
find anywhere in the browser to do that LOL!
SLG

Allen Browne said:
If you want to use the Find dialog to search the particular field, you will
need to leave its Enabled property to Yes. You can set Locked to No if you
wish. Set TabStop to No so that the user doesn't go there when tabbing
through the controls on the form if that helps.

The alternative would be to add an unbound control to the form, so the user
can type a number there, and press Enter to find the record without ever
needing to open the Find dialog. Use the AfterUpdate event of this text box
to FindFirst in the RecordsetClone of the form, and if found jump to that
record.

The event procedure would look something like this:

Sub txtGoTo_AfterUpdate ()
Dim rs As DAO.Recordset

If Not IsNull(Me.txtGoTo) Then
'Save before move.
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[CustomerID] = " & Me.txtGoTo
If rs.NoMatch Then
MsgBox "Not found"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
I have a statement form that contains an autonumber field for the statement
number. I want this field to be disabled or locked so that users don't go
into it, but I would like to be able to use Find within this field to
search
for a specific statement number. How can I do this?

Thanks so much!

Sandra G
 
A

Allen Browne

Well, I'll join you in feeling stupid, Sandra.
I only know about Access, not web interfaces. :)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
I hate to sound really stupid, but how do you "rate" the replies? I can't
find anywhere in the browser to do that LOL!
SLG

Allen Browne said:
If you want to use the Find dialog to search the particular field, you
will
need to leave its Enabled property to Yes. You can set Locked to No if
you
wish. Set TabStop to No so that the user doesn't go there when tabbing
through the controls on the form if that helps.

The alternative would be to add an unbound control to the form, so the
user
can type a number there, and press Enter to find the record without ever
needing to open the Find dialog. Use the AfterUpdate event of this text
box
to FindFirst in the RecordsetClone of the form, and if found jump to that
record.

The event procedure would look something like this:

Sub txtGoTo_AfterUpdate ()
Dim rs As DAO.Recordset

If Not IsNull(Me.txtGoTo) Then
'Save before move.
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[CustomerID] = " & Me.txtGoTo
If rs.NoMatch Then
MsgBox "Not found"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub

message
I have a statement form that contains an autonumber field for the
statement
number. I want this field to be disabled or locked so that users don't
go
into it, but I would like to be able to use Find within this field to
search
for a specific statement number. How can I do this?

Thanks so much!

Sandra G
 

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