469,353 Members | 2,060 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Open form that shows current record

I am new at Access, databases, AND posting threads (sorry). I have a subform that is a continuous form based on a tabular query. I enter a particular serial # (on the main form) and the subform shows me one to several forms that are related to that serial #. Each form shows only a few select fields of that particular record. I would like to be able to click a Veiw button (which is a cmd button on this subform) to bring up yet another form that would show ALL of the fields of that ONE SAME record. I've gotten as far as being able to get the view button to work when I have just the subform, itself, open. However, when I have the main form open (which then means the subform is also open), and click the View button, I get a dialog box to enter a parameter. Of course, once entered, the form pops up with the correct record referenced. Any help would be a godsend! Thanks! (Oh...Access 2003/XPPro)
Jan 17 '07 #1
4 12981
MMcCarthy
14,534 Expert Mod 8TB
I am new at Access, databases, AND posting threads (sorry). I have a subform that is a continuous form based on a tabular query. I enter a particular serial # (on the main form) and the subform shows me one to several forms that are related to that serial #. Each form shows only a few select fields of that particular record. I would like to be able to click a Veiw button (which is a cmd button on this subform) to bring up yet another form that would show ALL of the fields of that ONE SAME record. I've gotten as far as being able to get the view button to work when I have just the subform, itself, open. However, when I have the main form open (which then means the subform is also open), and click the View button, I get a dialog box to enter a parameter. Of course, once entered, the form pops up with the correct record referenced. Any help would be a godsend! Thanks! (Oh...Access 2003/XPPro)
What code are you using behind the view button?
Jan 17 '07 #2
NeoPa
32,184 Expert Mod 16PB
Yes, This will be a query of some form I suspect. Can you post the SQL of the query too if you use a QueryDef (saved query) in your code.
From your post it sounds like your query is using a parameter of some form. We need to replace that with the selection from your form but need the details first to know exactly how to.
Jan 17 '07 #3
Thanks for your replies, but I figured it out in the meantime! All I had to do was to use the cmd button wizard! Geez! I had created the button, originally, thinking I would have to use some specially created macro, so I had skipped the wizard... It created the following event procedure:

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdView_Click()
  2. On Error GoTo Err_cmdView_Click
  3.  
  4.     Dim stDocName As String
  5.     Dim stLinkCriteria As String
  6.  
  7.     stDocName = "frmViewSerNum"
  8.  
  9.     stLinkCriteria = "[idsNCRNum]=" & Me![idsNCRNum]
  10.     DoCmd.OpenForm stDocName, , , stLinkCriteria
  11.  
  12. Exit_cmdView_Click:
  13.     Exit Sub
  14.  
  15. Err_cmdView_Click:
  16.     MsgBox Err.Description
  17.     Resume Exit_cmdView_Click
  18.  
  19. End Sub
I'll be posting with some other problem soon, I'm sure! Thanks again!
Jan 17 '07 #4
NeoPa
32,184 Expert Mod 16PB
That's fine and thanks for replying.
It's actually better when the OP finds the solution themselves. It indicates learning and growth :)
Jan 17 '07 #5

Post your reply

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

Similar topics

1 post views Thread by simonmarkjones | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.