×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Form with tabbed pages for subforms

Form with tabbed pages for subforms

Form with tabbed pages for subforms

(OP)
Hello Everyone: I have a main form with many subforms placed on tabbed pages, all linked to the main form. I would like to change some the subforms to be opened by a button instead. But the problem is that some of the subforms have not yet been populated, so I will need to pass the main form's primary key to the subform that opens. Just so the user does not have to enter it again.

CODE --> vba

Private Sub BtnPound_Release_Click()


DoCmd.OpenForm "SubformCatDetailsPoundRelease", WhereCondition:="[Pound_Sheet_No]=" & Me![Pound_Sheet_No], WindowMode:=acDialog, OpenArgs:=Me.Pound_Sheet_No

End Sub 

I get an error, Enter Paramater value "zb". That [Pound_Sheet_No] is 1000-zb. So, I don't understand how to fix this.

If there is an easier way to change a linked subform to a button, please let me know.

Thank you, Sophia




RE: Form with tabbed pages for subforms

Apparently the Pound_Sheet_No field is text. Try

CODE --> vba

Private Sub BtnPound_Release_Click()

DoCmd.OpenForm "SubformCatDetailsPoundRelease", WhereCondition:="[Pound_Sheet_No]='" & Me![Pound_Sheet_No] & "'", WindowMode:=acDialog, OpenArgs:=Me.Pound_Sheet_No

End Sub 

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016

RE: Form with tabbed pages for subforms

(OP)
Thank you Duane. That was the issue for the error. But now when the subform opens and I fill in the data, the [Pound_Sheet_No] does not transfer to the subform automatically. I thought that that code would do it?

Sophia

RE: Form with tabbed pages for subforms

You would need to set the default value of the linking/child field to the contents based on the value of OpenArgs.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016

RE: Form with tabbed pages for subforms

(OP)
Thanks again Duane. It is working now.

Is there an easier way to have a button open a linked subform? It is so easy to have subform linked to a main form the traditional way by having both forms on screen.

Sophia

RE: Form with tabbed pages for subforms

I'm not sure why you want to open a new form when a subform can be used.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016

RE: Form with tabbed pages for subforms

(OP)
I want to open a form with a button, to save space on the main form. There are too many subforms showing in the Page Tabs across the screen, with the subforms on the page tabs.
I am just trying to make it visually better to look at.

Sophia

RE: Form with tabbed pages for subforms

You have a process now with openargs and setting the default value. There are methods for hiding subforms until needed. I expect your app might not show more than 2-3 subforms at any point.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016

RE: Form with tabbed pages for subforms

(OP)
Thanks for the advise. :)

Sophia

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close