Thanks Nikos,
i used the first code on my main menu button, that works fine, thanks, i
would have never found that.
i came up with a problem with the expertise becuase of the way i structured
my expertise form but that is for another time. so i tried it with the
employee availability form, i used the following code : -
Private Sub cmdAvailability_Click()
On Error GoTo Err_cmdAvailability_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmEmployeeAvailability"
DoCmd.OpenForm stDocName, , , stLinkCriteria
EmployeeID = Me.EmployeeID
DoCmd.OpenForm frmEmployeeAvailability
DoCmd.GoToRecord acDataForm, frmEmployeeAvailability, acNewRec
Forms![frmEmployeeAvailability].EmployeeID = EmployeeID
Exit_cmdAvailability_Click:
Exit Sub
Err_cmdAvailability_Click:
MsgBox Err.Description
Resume Exit_cmdAvailability_Click
End Sub
this opens the employee availability form and a message "You cant assign a
value to this object" comes up, so i click "ok" and i have to scroll to the
new employee id and then enter the availability dates.
Please can you tell me where i am going wrong, i want to click the
availablity buton on the employee form and have the new employee id on the
availblity form, so i can enter the dates straight away.
sorry Nikos, thanks
Nikos Yannacopoulos said:
Don,
In the Employee form's On Open event, paste:
DoCmd.GoToRecord , , acNewRec
to take you to a new record each time the form is opened. Alternatively,
you can put the code right after the OpenForm command (wherever you run
that from):
DoCmd.GoToRecord acDataForm, "EmployeeFormName", acNewRec
so you only go to a new record when opening the form from your main
menu, istead of every time,regardless of how the form is opened.
Now, the code behind the button on the employee form would be something
like:
empid = Me.Employee_ID
DoCmd.OpenForm "Employee_Expertise"
DoCmd.GoToRecord acDataForm, "Employee_Expertise", acNewRec
Forms![Employee_Expertise].Employee_ID = empid
I hope my assumptions of form and control names are obvious, so you can
substitute with the acual ones.
HTH,
Nikos
Hello,
Can anyone help me ?
from the main menu, i am trying to open the employee form so that i can
directly enter a new employee, instead of using another button or scrolling
to the last record and entering a new employee becuase at the moment i can
get the button to open the form but i have to press the "add new record"
button.
Then from this form, i need a button that directs me to the employee
expertise form and automatically enters the employee ID and allows
me to enter expertise for that employee.
can this be achieved
i think that both of these buttons will have the similiar coding.
Thank you