Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open form with relevant info 1

Status
Not open for further replies.

Troopa

Technical User
Nov 9, 2001
96
GB
Hi,

Could you let me know how I can do this?

I have a main form for a bunch of procedures and I want a button that will open a new form "Review Form" but for the review form to have the procedure info.

E.g. Procedure 10 is up for a review, so I go into my main form and to the record for the particular procedure. I then click new review and the review form pops up for me to enter all the review info. It needs to hold the procedure number so that I can later see when each review took place.

What's the best way of doing this?

I think I have my relationships setupcorrectly but any advise on this also would help.

Thanks in advance
 
Troopa

Try something like this code behind a command button...
Code:
Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "ReviewFormName"
    stLinkCriteria = "[ProcedureNbr]=" & Me![ProcedureNbr]
 
    DoCmd.OpenForm stDocName, acNormal, , , acFormAdd
    Forms!ReviewFormName!ProcedureNbr.Value = Me.ProcedureNbr.Value
    Forms!ReviewFormName!WhateverField.SetFocus

Tom
 
Not sure what's happening here Tom?

I've got the code working ok, with respect to opening the review form and it displaying the procedure number from the original form but the relationships between the two tables isn't being maintained.

When I add the review form as a sub form into the main procedure form everything is ok so I think that the relationships are correct.

can you explain a little about the code you've posted?
 
Troopa
You mention "two tables." I'm not clear what those two tables are, so don't know what to suggest regarding that.

What the procedure I posted does is this...
1. open a second form which has only the ReviewNbr from your first form filled in
2. Set the focus to whatever other field you desire, in order to add the relevant data in the other fields.

That's what I thought your original post wanted. Maybe I missed something.

Tom
 
Tom your info was / is of much help. I still have to sort out a few things with the relationships but I've got most of it sorted.
Thanks for your help
 
Troopa
Post back if you still need help.

Good luck with your project.

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top