Open Form from link in datasheet

XCON187

New member
Local time
Today, 11:00
Joined
Sep 23, 2010
Messages
3
Hi,

I am having a problem with the attached database in that I am trying to open the courses attended sub form from a list of contacts in the contacts data sheet, I have tried doing this with the openform macro and setting the where condition to equal the Contact ID and also using VBA code but with no success. The form opens at record 1 whichever record is selected and no records are displayed in the form.

I am fairly new to this whole access business and any help would be greatly appreciated.
 

Attachments

Did you really zip your database file or did you just rename it to .zip? It doesn't appear to be a valid zip file. What version of Access are you using?
 
Ah, sorry, I did zip the file however I used 7-Zip rather than winzip and had to rename the file from .7z to .zip. The attached copy I have done straight from 7-Zip as a .Zip file and should work fine.

I am using Access 2007

Many Thanks
 

Attachments

Okay, a few issues -

1. In the Courses and Contacts table you have Contact ID and Course Taken By. From what I'm seeing, unless I don't understand the difference between the Contact and the Course Taken by - you should only have Contact ID there and capture the Contact's ID from the Contacts table. Right now you don't have it structured right in the table.

2. You have a subform on the form which you are trying to filter when opening but you do not have the Master / Child links set and they really shouldn't either because your form and subform are using the same table as their record sources.

So, just changing the code so the subform opens to the right contact ID was simple enough.

strWhere = "[Contacts And Courses].[Contact ID]=" & Me.Text14


But the way you have it, I'm not too clear on how you are going to open the main form but filter the subform.
 
Thanks that seems to have got me some of the way, record numbers seem ok but not displaying content which I guess maybe due to the other issues you mentioned.

The Course Taken by field isn't related to the contact, it is just the name of the engineer who taught the training course.

Thanks for your help

Mark
 

Users who are viewing this thread

Back
Top Bottom