tblLeave is for recording user absences? tblLeave should have a field for UserID, not Username. Then filter the records when form opens as described in post 6.
tblLeave is for recording user absences? tblLeave should have a field for UserID, not Username. Then filter the records when form opens as described in post 6.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
hmmm how to say... i'm attached with my latest progress.. tblLeave is for store leave that apply by employee.. as i think that 1 employee might have many leave right? What i have in FormApplyLeave is include all the attribute of the tblLeave and inside the tblLeave there is foreign key called UserID that linked to tblUsers that is known as employee.. When employee apply for the leave the FormApplyLeave is appeared.. What i want to do is when employee fill up the leave field, its possible make the UserID text box is auto detect or auto filled based on which user login?Database3.zip
The ApplyLeave button is opening frmViewDetail. Should that be opening frmApplyLeave? Why would you need code to set UserID of frmViewDetail? Why use DLookup when the UserID is already available on frmMainEmployee?
Need to close formMainEmployee or don't set it as Popup & Modal.
DoCmd.OpenForm "frmApplyLeave", , , "UserID=" & Me.fldLoginID, , , Me.fldLoginID
DoCmd.Close acForm, frmMainEmployee, acSaveNoCode
Code behind frmApplyLeave to move to new record and set the UserID.
Private Sub Form_Load()
DoCmd.GoToRecord , , acNewRec
Me.UserID = Me.OpenArgs
End Sub
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
err wait a sec what does ", , ," mean? >>DoCmd.OpenForm "frmApplyLeave", , , "UserID=" & Me.fldLoginID .. the parameter make me confuse..The ApplyLeave button is opening frmViewDetail. Should that be opening frmApplyLeave? Why would you need code to set UserID of frmViewDetail? Why use DLookup when the UserID is already available on frmMainEmployee? Need to close formMainEmployee or don't set it as Popup & Modal. DoCmd.OpenForm "frmApplyLeave", , , "UserID=" & Me.fldLoginID, , , Me.fldLoginID DoCmd.Close acForm, frmMainEmployee, acSaveNoCode Code behind frmApplyLeave to move to new record and set the UserID. Private Sub Form_Load() DoCmd.GoToRecord , , acNewRec Me.UserID = Me.OpenArgs End Sub
Orite im good to go.. thank again.. i will continue this thread until i finish up just left few things.. when we apply leave, the textbox in FrmApplyLeave will automatically set the ID and userID and it directly saved in tblLeave.. any command that make it appear in textbox but it didnt added in tblLEave? Until i press Add button it will automatically add the LeaveID and UserID in tblLeave
you have to do admin because its have all functionality..
read this
Last edited by sherrysansone; 05-17-2014 at 12:18 AM.