I think you should explain further on what you are trying to do because opening a Form based on a previous Form is something different than what you initially postef. So, before posting suggesting anything please explain in depth what you are trying to do.
Ok Sure. I am creating login details for my database. I want to display the records entered by the user only. My login form is under the name "Form_Login form" and the main form name is Form_Calender. So I dont know how to get the username from login form to the calender form.
cboStaffName = [Forms]![Login Form]![txtlogin] is not working. It returns Null?
My form name=Login Form&Calender; Coding is in Form_Login form&Form_Calender.
I want to display the records entered by the user only. So I don't know how to get the username from login form to the calender form.
cboStaffName is the variable name in calender, where I want to retrieve the username.
txtlogin is the textbox to enter username.
cboStaffName = [Forms]![Login Form]![txtlogin] is not working. It returns Null?
Also there is an error msg: "The expression you entered refers to an object that is closed...
Coding in OK button:
If UserLevel = 1 Then
DoCmd.OpenForm "Calender"
Forms![Calender]![txtuser] = Me.txtlogin
Forms![Calender]![txtpwd] = Me.txtpassword
So, Once the calender form opens, the remaining code are not executing? and will the login form automatically closed?
Thank you so much. I found the solution. Before I start checking the userlevel, I am closing the form using the code DoCmd.Close and I deleted that and its working fine.