Opening new form with record selected in datasheet.

jonifen

Registered User.
Local time
Today, 22:47
Joined
Feb 5, 2003
Messages
34
I have followed the instructions from here - http://www.access-programmers.co.uk/forums/showthread.php?t=35924 (and used a bit of my own knowledge (which isnt much!)) - to help me set up a datasheet, so when a record is double-clicked, it puts it into a new window in a form view so it can be viewed clearer.

This works great, but only if the datasheet is opened in its own window. If the datasheet is in a subform (as I want it to be), then it does not work, and it pops up a box asking for me to enter in a recordnumber (the field which I am linking both fields on)... When the datasheet is in its own window, it gets the information fine.

How do I go about editing the code which I'm using to make this work?

StoreInformationQry = Main form
RelatedLDTInformation = subform (datasheet which has the list of records in which are related to a store number in the main form)
RelatedLDTInformation2 = new form which loads when a record in "RelatedLDTInformation" is double clicked.

Code used (it has been put in "RelatedLDTInformation" as a onDblClick procedure).

Thanks in advance. I will explain further if needed.
 
try this...

Hello,

1. Make sure the form1 and form2 has some kinda connection, Like, same record id # or something that is unique.

2. create a command button and put something like following.
DoCmd.OpenForm "frm2", , , "[RecordID]='" & [RecordID] & "'"

you r telling the system open a record in form2 that has same record id # as form1.

Hope it helps.

Good luck.

Dianna Goldsberg
 
OK... that kind of made sense...

I came up with this code using your post Pat...

Private Sub Form_DblClick(Cancel As Integer)
DoCmd.OpenForm "RelatedLDTInformation2", , "[Record]=Forms!StoreInformationQry!RelatedLDTInformation!RelatedLDTInformation2.Form.RecordNumber"
End Sub

that is what I think you referred to as the "slow" version. I just want to get it working at first... I can learn how to speed it up afterwards really as the DB is still very small. I know I'm doing it wrong as it's still not working...

thanks for your help with this


edit: sorted it... I had a bit of a mental block... but it is sorted now :D

thanks
 
Last edited:

Users who are viewing this thread

Back
Top Bottom