G
Guest
My orginal post is below, and a response I received is below that. The
problem is I am missing something. I have been working on this for a week now
and I do not understand what I am doing in part.
***Orignal post***
I want to use one form 'frmAssignTime' to enter information in a text box
such as [0830] on the form 'frmSchedule' by using the dbl click event of a
text box [0830LastName].
The form 'frmSchedule' has a hidden text box for each 30 minute time slot,
hence 0830, 0900, 0930 and so on.
Double clicking on the text box [0830LastName] opens the form
'frmAssignTime'.
The form 'frmAssignTime' allows the user to select a patient name and click
on a button to assign that patient's PatientID value to the [0830] text box
on the 'frmSchedule'. Then the [0830LastName] looks up the patients last name
and displays it.
I want to use the same form for all the [0830LastName], [0900LastName] etc..
text boxes double click event. so I need to pass a string to the form
'frmAssignTime' that contains the field name of the hidden text box [0830],
[0900] etc...
***Reply to my post, code only***
For instance in the frmSchedule module:
Private Sub 0830LastName_DblClick(Cancel As Integer)
Call OpenAssignTime(Me.0830)
End Sub
Private Sub OpenAssignTime(tb As Access.TextBox)
Dim f As Access.Form
DoCmd.OpenForm "frmAssignTime", acNormal
Set f = Forms("frmAssignTime")
Set f.Target = tb
Set f = Nothing
End Sub
In the frmAssignTime module:
Private m_target As Access.TextBox ***This part I am not sure about***
Public Property Set Target(tb As Access.TextBox) ***This and the line
above***
Set m_target = tb ***I've put in a Module***
End Property
Private Sub btnAssignID_Click() ***This is in the form's Assign Button***
m_target.value = Me.PatientID
Set m_target = Nothing
DoCmd.Close
End Sub
I am fairly sure I have not put something in the right place. I get an error
that states Object Required when I try clicking on the button.
Can someone help me to understand this.
Cheers
problem is I am missing something. I have been working on this for a week now
and I do not understand what I am doing in part.
***Orignal post***
I want to use one form 'frmAssignTime' to enter information in a text box
such as [0830] on the form 'frmSchedule' by using the dbl click event of a
text box [0830LastName].
The form 'frmSchedule' has a hidden text box for each 30 minute time slot,
hence 0830, 0900, 0930 and so on.
Double clicking on the text box [0830LastName] opens the form
'frmAssignTime'.
The form 'frmAssignTime' allows the user to select a patient name and click
on a button to assign that patient's PatientID value to the [0830] text box
on the 'frmSchedule'. Then the [0830LastName] looks up the patients last name
and displays it.
I want to use the same form for all the [0830LastName], [0900LastName] etc..
text boxes double click event. so I need to pass a string to the form
'frmAssignTime' that contains the field name of the hidden text box [0830],
[0900] etc...
***Reply to my post, code only***
For instance in the frmSchedule module:
Private Sub 0830LastName_DblClick(Cancel As Integer)
Call OpenAssignTime(Me.0830)
End Sub
Private Sub OpenAssignTime(tb As Access.TextBox)
Dim f As Access.Form
DoCmd.OpenForm "frmAssignTime", acNormal
Set f = Forms("frmAssignTime")
Set f.Target = tb
Set f = Nothing
End Sub
In the frmAssignTime module:
Private m_target As Access.TextBox ***This part I am not sure about***
Public Property Set Target(tb As Access.TextBox) ***This and the line
above***
Set m_target = tb ***I've put in a Module***
End Property
Private Sub btnAssignID_Click() ***This is in the form's Assign Button***
m_target.value = Me.PatientID
Set m_target = Nothing
DoCmd.Close
End Sub
I am fairly sure I have not put something in the right place. I get an error
that states Object Required when I try clicking on the button.
Can someone help me to understand this.
Cheers