V
vircalendar via AccessMonster.com
I'm going crazy. I've been messing with this all day and can't see what must
be a simple problem.
A form contains a field called order_attending. It populates doctors' names
from a dropdown list or free text. If the submitted free text is not on the
list, this initiates a "not in list event," which takes the user to a form
called frm_newdoc on which a new doctor name, pager number, etc, can be
entered. On the other hand, if the operator is happy with the text in the
field but wants to see pager numbers, etc, he or she can double-click on the
field and go to the secondary form. Problem is that the secondary form opens
blank. The "where" data is not being transferred. Why not?
Here's the code:
On the primary form:
Private Sub Order_attending_DblClick(Cancel As Integer)
Forms!exam_history.TimerInterval = 0 'pause timer on background form
DoCmd.OpenForm "frm_newdoc", , , "order_attending = forms![exam_history]!
[order_attending]", , acDialog, "old"
Forms![exam_history].TimerInterval = 1000 'restart timer"
End Sub
Private Sub Order_attending_NotInList(NewData As String, Response As Integer)
Forms!exam_history.TimerInterval = 0 'pause timer on background form
Dim intResponse As Integer
strMsg = NewData & " is not a known Referring Attending. Add him or her?"
intResponse = MsgBox(strMsg, vbYesNo + vbQuestion, "Unknown Referrer")
Select Case intResponse
Case vbYes
DoCmd.OpenForm "frm_NewDoc", acNormal, , , acFormAdd, acDialog, "new"
& NewData
Case vbNo
Response = acDataErrContinue
End Select
Forms![exam_history].TimerInterval = 1000 'restart timer
End Sub
On the secondary form:
Private Sub Form_open(Cancel As Integer)
dim strNewDoc as string
If OpenArgs = "old" Then 'doc is known. Just show his record
Else 'doc is new. start data collection
DoCmd.GoToRecord acDataForm, "frm_newdoc", acNewRec
strNewDoc = Right(OpenArgs, Len(OpenArgs) - 3)
If strNewDoc Like "*" & "," & "*" Then
Me.ref_lastname = Left(strNewDoc, (InStr(strNewDoc, ",") - 1))
Me.Ref_firstname = LTrim(Right(strNewDoc, (Len(strNewDoc) - InStr
(strNewDoc, ","))))
ElseIf strNewDoc Like "*" & " " & "*" Then
Me.Ref_firstname = Left(strNewDoc, (InStr(strNewDoc, " ") - 1))
Me.ref_lastname = LTrim(Right(strNewDoc, (Len(strNewDoc) - InStr
(strNewDoc, " "))))
Else
Me.ref_lastname = strNewDoc
End If
End If
Me.Ref_firstname.SetFocus
End Sub
be a simple problem.
A form contains a field called order_attending. It populates doctors' names
from a dropdown list or free text. If the submitted free text is not on the
list, this initiates a "not in list event," which takes the user to a form
called frm_newdoc on which a new doctor name, pager number, etc, can be
entered. On the other hand, if the operator is happy with the text in the
field but wants to see pager numbers, etc, he or she can double-click on the
field and go to the secondary form. Problem is that the secondary form opens
blank. The "where" data is not being transferred. Why not?
Here's the code:
On the primary form:
Private Sub Order_attending_DblClick(Cancel As Integer)
Forms!exam_history.TimerInterval = 0 'pause timer on background form
DoCmd.OpenForm "frm_newdoc", , , "order_attending = forms![exam_history]!
[order_attending]", , acDialog, "old"
Forms![exam_history].TimerInterval = 1000 'restart timer"
End Sub
Private Sub Order_attending_NotInList(NewData As String, Response As Integer)
Forms!exam_history.TimerInterval = 0 'pause timer on background form
Dim intResponse As Integer
strMsg = NewData & " is not a known Referring Attending. Add him or her?"
intResponse = MsgBox(strMsg, vbYesNo + vbQuestion, "Unknown Referrer")
Select Case intResponse
Case vbYes
DoCmd.OpenForm "frm_NewDoc", acNormal, , , acFormAdd, acDialog, "new"
& NewData
Case vbNo
Response = acDataErrContinue
End Select
Forms![exam_history].TimerInterval = 1000 'restart timer
End Sub
On the secondary form:
Private Sub Form_open(Cancel As Integer)
dim strNewDoc as string
If OpenArgs = "old" Then 'doc is known. Just show his record
Else 'doc is new. start data collection
DoCmd.GoToRecord acDataForm, "frm_newdoc", acNewRec
strNewDoc = Right(OpenArgs, Len(OpenArgs) - 3)
If strNewDoc Like "*" & "," & "*" Then
Me.ref_lastname = Left(strNewDoc, (InStr(strNewDoc, ",") - 1))
Me.Ref_firstname = LTrim(Right(strNewDoc, (Len(strNewDoc) - InStr
(strNewDoc, ","))))
ElseIf strNewDoc Like "*" & " " & "*" Then
Me.Ref_firstname = Left(strNewDoc, (InStr(strNewDoc, " ") - 1))
Me.ref_lastname = LTrim(Right(strNewDoc, (Len(strNewDoc) - InStr
(strNewDoc, " "))))
Else
Me.ref_lastname = strNewDoc
End If
End If
Me.Ref_firstname.SetFocus
End Sub