glitch: opening form to specific record using its ID

L

LightByrd

Hello all!
I have a form which accepts a partspec of a last name and then displays in a
subform all records that match.
I then allow the user to click on the ID of the desired record and opens the
main form to that record.
Here is the code:

' IncidentID is key field of main table
'Me,txtIncidentID is value of textbox in subform
strWhere = "[IncidentId]=" & Me.txtIncidentID
DoCmd.Close
DoCmd.OpenForm "frmcallout", , , strWhere

Works great...except:
When the main form is displayed, if any attempt is made to access another
record (e.g. page down or using the navigation buttons), it opens a new
record.
I would like the displayed record to remain editable (which it is now) but
to return to the Master Menu is any attempt is made to display another
record.

Any ideas?
 
D

DrGUI

In the main form's property sheet, go to the DATA tab. Set the "Allow
Addition" property to No
 
L

LightByrd

DrGUI said:
In the main form's property sheet, go to the DATA tab. Set the "Allow
Addition" property to No

Would that not preclude additions when the form is used for that purpose
instead of just finding a specific record?

--
Regards,
Richard Harison


LightByrd said:
Hello all!
I have a form which accepts a partspec of a last name and then displays
in a
subform all records that match.
I then allow the user to click on the ID of the desired record and opens
the
main form to that record.
Here is the code:

' IncidentID is key field of main table
'Me,txtIncidentID is value of textbox in subform
strWhere = "[IncidentId]=" & Me.txtIncidentID
DoCmd.Close
DoCmd.OpenForm "frmcallout", , , strWhere

Works great...except:
When the main form is displayed, if any attempt is made to access another
record (e.g. page down or using the navigation buttons), it opens a new
record.
I would like the displayed record to remain editable (which it is now)
but
to return to the Master Menu is any attempt is made to display another
record.

Any ideas?

--
Regards,
Richard Harison


.
 

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