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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking Forms 1

Status
Not open for further replies.

TheStriker

Programmer
Aug 19, 2002
109
0
0
US
I have several forms that I would like to display different fields from one table or query. The problem is when I click the command button to open the next form, it doesn't display the record from the previous form. It goes back to the first record. How can I get the forms to display the same record and then have the very LAST form go to the next record to repeat the process.

Your help is appreciated.

Thanks in advance.
 
Include is code in the Command button's on click:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "NewFormNameHere"

stLinkCriteria = "[JobID]=" & Me![JobID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

JobID should be replaced with whatever you are using to link your data together.
 
Hi

You are presumably openning the forms with docmd?

well the syntax is:

DoCmd.OpenForm formname[, view][, filtername][, wherecondition][, datamode][, windowmode][, openargs]

so put in a where clause that idetifies the relevant record so

DoCmd.OPenForm "MyForm",,,"RecordId = '" & Me.RecordId & "'"

You will have to select the correct control to identify the record, and use you form name etc of course

also if the Unique Id is not a string column, then you do not need the '

Also, have you not thought of combining the forms into one, and using the Tab Control? Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
 
Thanks for the advice and it seems like it working. I guess the next challenge is how to I go to the next record when the last form is completed.

BTW, I have tried putting it all on one form but and didn't have enough space (i.e too many controls).

Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top