We help IT Professionals succeed at work.

How Do I Open A Form To A Specific Record?

jammin140900
jammin140900 asked
on
530 Views
Last Modified: 2013-11-28
Hi experts.

I've got a form which I want to open and filter the form to a "ASGeneralWebsiteRegID". The article table (the one being opened) may not have a ASGeneralWebsiteRegID, but using the cascade update relationship, I presumed since this is opening on filter, it would automatically insert the filtered ASGeneralWebsiteRegID for every new article record.

I've attached a document with screen shots below to shed further light. I'm not sure why the article table appears to open up on filter, but on closer inspection, you see it has "0" and not linking?

Could you please advise how I can open up the article form, using the Registration form's current ASGeneralWebsiteRegID and therefore every new article added would automatically add the current filtered ASGeneralWebsiteRegID?

Thanks,
J   Form-Open-Filter-Problem-260411.doc
Comment
Watch Question

Author

Commented:
Had to make a small change in the last hour. I now have WebsiteID from tblWebsite and tblASArticle in a relationship (Cascade update and Delete). Changed the Article Form and the Open Form button on the Regstration form to reflect this change.

Still doesn't open the Article Form using the current Registration Form's Website ID.
Scott McDaniel (EE MVE )Infotrakker Software
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014

Commented:
Your code is correct, assuming you're properly picking up the ASGeneralWebSiteRegID (or whatever field you're using). Does your query properly filter those results? That is, if you open the query in Design view and place the value 55 in the Filter row for that field, do you then see the correct record(s) show in your query?

If you don't, then you need to get the query right. The form can only show those records as provided by the query.

<but using the cascade update relationship>

Cascade Update has no bearing on this issue, and in fact is a setting that you should NOT be using in a properly structured database. Cascade update simply updates any values in child tables IF the Primary Key of the parent table changes. IN a well designed system it is very, very rare that this will ever happen.

Author

Commented:
I checked the filter and it is correct.

Thanks for the explanation for the cascade update. I forgot the purpose for that (not having to build a database in ages!)

So, lets say you have a table called Product and another table called Comment. Product contained Product ID, Product Name (and so on..) and Comment contained Comment ID, Comment and Product ID.

Let's say you had two forms, one for each table. Comment was in datasheet form. You also had a button on the Product Form that allowed you to open the Comment Form on the current Product ID. Obviously the Product ID may not exist in the Comment form as yet.

How do you insert the Product ID in the comment form so that it would open correctly and secondly, then filter the comment form so that everytime you entered a new comment for that same product, the ProductID would add itself in the comments table? Is it perhaps a table property that requires changing in the Comments table or the establishing of a relationship?



Scott McDaniel (EE MVE )Infotrakker Software
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Top Expert 2009
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks guys. The theory makes sense. Just not very confident in applying it just yet!

I've attached a sample database.

Ok. When you open the database, on the frmWebsite, using the 'Select Website', select "learntosing.com"

Click on the red button "Article Submitter Registration"
Click on the red button "Go To Article Details" at the bottom

and now you open the form ASArticleDetails. You'll notice that it's come in filtered on WebsiteID = 11.

So, when I click on "Add New Article", how do I keep the WebsiteID = 11 for every new record?


 Sample-Database.mdb
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Brilliant Manthanien.. So simple but works a treat! Thank you!
CERTIFIED EXPERT
Top Expert 2009

Commented:
You can also set the value of a textbox on the form from a saved database property -- I use this technique on a main menu.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.