469,647 Members | 1,789 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,647 developers. It's quick & easy.

open pop up form to specific record or create new record

Hello, I am new to Access and this forums,

I have two tables and two forms to display the data.



Tbuilding stores basic building data, while Tcriteria stores specific data for some, but NOT ALL, buildings. The two tables are linked through the building ID number(TrusteeID), which is the key in Tbuilding

I would like to create a command button in fmbuilding that opens fmcriteria as a “pop-up” form (not subform, I know it would be easier but need “pop-up” for other reasons, not programming related). I need the “pop-up” form to open to the specific record of the building currently displayed in fmbuilding. I have been able to do this so far with DoCmd.OpenForm and stLinkCriteria, however, if a building does not have a record in fmcriteria, I would need to create a new record in tcriteria and I have been having trouble getting there.

In other words, could I have the command button in fmbuilding open fmcriteria to the current record and if record does not exist go to a blank record using the new TrusteeID so the user can enter the data?

I have not used VBA very much so I am new to this level of design. Please, any help would be greatly appreciated.

I am using Access 2003

Aug 29 '08 #1
1 5713
32,203 Expert Mod 16PB
I think the concept here is fairly straightforward. From your question you seem to understand the concepts well enough, so I'll pitch my answer for what I think you can grasp. If anything's confusing though, or you need more direction to either understand or implement this then just say so.

What you need, should be simply to open [fmCriteria] from the CommandButton passing a filter in the DoCmd.OpenForm call.

The form will open with the correct record displayed if one exists, otherwise it will open on the New Record slot.

If it's important to set any values in this record so that it matches what you need then that also can be managed, but you don't say what, if any, fields this might apply to.
Aug 29 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by BD | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.