Open Form displaying a specific record not using WHERE

  • Thread starter Thread starter ginodatreviso
  • Start date Start date
G

ginodatreviso

Guest
Hello,
I've a continuous form ("ALLRECORDS") displaying many records. I've a button on the form footer that opens another form ("DETAILS") with all the details of the record.
I'd like the form "DETAILS" to open displaying the current record but also enable the user to go to previous or next record without having to close form "DETAILS". If I use WHERE "ID = " me.ID the user will be allowed only to see that record.
I'd also like the user to be allowed to edit the records in form "DETAILS" but not to insert a new record.
How can I do this??
Thanks a lot for your help
 
Try pasting this code in a command button.

On Error GoTo Err_Handler

On Error GoTo Err_Handler

Dim strFieldName As String
Dim strForm As String

strForm = "FormYouWishToOpen"
strFieldName= "[FieldName]='" & Me.FieldName& "'"

DoCmd.OpenForm strForm, , , strFieldName

Exit_Here:
Exit Sub

Err_Handler:
MsgBox Err.Description & " " & Err.Number
Resume Exit_Here


hth,
Michael
 
hello Ukraine82, thanks for your help, but unfortunaly it doesn't do what I'd like.
Using your code the form "DETAILS" is loaded and shows the right record but
the user cannot see any other record.
Do you understand what I mean?
Thank you
 
:p Hello gino!
I think I know what you need.
Look at "DemoDetailsA97.mdb"
(MStef alias Štef)
 

Attachments

Gino,

I'm not 100% sure if you can open a specific record without being filtered. My code is pretty much the same as MStef sample database.

hth,
Michael
 

Users who are viewing this thread

Back
Top Bottom