Problem with Link ID in form

mickelingon

Registered User.
Local time
Today, 15:42
Joined
Feb 3, 2006
Messages
72
Hi

I have a form with buttons that I've found i the sample database.
When I click the buttons I get one of my forms in the destination window.
But the form doesn't link to the right link ID, is this something you can code?

Attached is the sample. (not with my form in though, but you get the picture)

Mikael
 

Attachments

On the form in your example each buttem is named cmd1, cmd2, etc.
In the VBA code behind each button there is one line of code

here is an example

Code:
Private Sub cmd3_Click()
     Me.frmSubImage.SourceObject = "frm_ImageSub_2"

End Sub

frmSubImage is the destination window
frm_ImageSub_2 is the name of the form that appears in the destination window.

When you make a form that you want to appear in the window you need to go into the VBA code behind the relevent button and change the form name in quotes to the name of the form that you have created.
 
I'm with you so far.
But when I've entered the form name and it displays when I push the button, it doesn't get the right values.
Can you program the buttons in the code so they point to the right referens ID.?

In the tables i've created the primary key is the ID tag and the numerous forms has the same key so the can link information from my search form.
But this doesn't connect to the right searchresult.

Sorry if this seems fuzzy
 
are your main form and sub forms bound?

if so I think you may be able to set the LinkChildFields and LinkMasterFields of the subform in your VBA before you open the form


Code:
frmSubImage.LinkChildFields = 'the ID from the subform record source
frmSubImage.LinkMasterFields = 'the ID from the main form record source
frmSubImage.SourceObject = "frm_ImageSub_2"

I don't know if you need to open the form before or after you set the link fields... or if this will even work.
Give it a try.
 
Ok if I explain it like this.
I have a mainform with a serch option.
Then I have another form that displays information about the displayed search.

How do I get this form to link to the displayed search?
Where do I put the reference for it?

Thanks
 

Users who are viewing this thread

Back
Top Bottom