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

Opening a form within a form

Status
Not open for further replies.

MarkWaddington

Programmer
Aug 19, 2002
64
0
0
GB
Hi, I have a main form on my database, and in turn I click on a command button and it opens another form with the same Autonumber primary key as the first form. Here's the code:

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Client_Status"

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

This works ok on existing records, but if I make a new record and click the open form button, it doesn't automatically make another record on the other form.

In the past, the way I have got round this is by adding one extra line of code underneath the other code, which is:

Forms![Client_Status]![StatusNo] = Forms![Client]![RegNo]

This sets the opened form in sync with the main form, and creates a new record if necessary.

My problem is that all changes to these forms are logged by the date and time and the user that updated the form. When a form is opened the line of code is treated as an UPDATE. Now I don't want this, I only want it to be classed as an update when data is entered into this form.

Any way round this?

Thanks in advance.

Mark Waddington.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top