Two Forms

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

I have two forms - Employee Data and Employee Assignments.
Both forms have some similar fields such as EmployeeID,
FirstName, LastName, HireDate, Department. On the Employee
Assignments form, I have additional fields such as
StartDate, EndDate, AssignmentCode, AssignmentType.

Normally, the Employee Data form is completed sevral days
before the Employee Assignment form is first used.
However, sometimes we may hire a new employee and from the
Data form, we want to click a command button to take us to
the Assignments form for this employee.

My code is as follows:

Dim strDocName As String
Dim strWhere As String

strDocName = "Employee Assignments"

DoCmd.DoMenuItem as FormBar, ac RecordsMenu, ac
SaveRecord, ac MenuVer 70
DoCmd.OpenForm strDocName, acNormal, strWhere

Whenever I press the command button, I go to the first
record in the Assignments form rather than the currect
record from the Data form. Any ideas what I'm missing?
 
I take it that the variable "strWhere" is a filter?
Depending on how you create the filter, this will open
the form with one or more records, but it will be only
the records meeting the requirements of the filter. You
may have a problem in the filter. Copy the text of this
filter to the SQL view of a query in the query builder.
Run it there. Does it bring back the correct records? If
not, fix the sql string.

Hope this helps!

Kevin
 
Back
Top