Access code to copy field from one form to another form
Posted on 2013-01-17
In Access 2010 I have a form named frmTimeOff. In the form I have the following fields.
EmpInit | DateOff | Hours | Comments
I also have a table name Calendar which is a link to a SharePoint Calendar. From this table I created a form named frmCalendar.
The frmCalendar has the following fields.
Title | Start Time
I placed a Command button in the frmTimeOff form so when clicked it copies the record from the frmTimeOff form to a record in the frmCalendar. Note the frmTimeOff form is a Continuous form so I have a button next to each record.
I've tried different variations of the following code, but can't get anything to work. Note I'm only showing copying one field for this example.
Private Sub cmdUpdate_Click()
Dim intCopyNum As Variant
intCopyNum = Me.DateOff.Value
Forms!frmCalendar.Form.Start_Time.Value = intCopyNum
Can anyone help me with this?
Thanks in advance!