L
Loralee
I have an unbound dialog form (frmAddFirstPractitioner) that collects
information from the user. When the user clicks the "okay" button on
frmAddFirstPractitioner, a sub saves the new record and launches another form
with a subform on it. I want the form/subform to open with the new record
open. The form that is launched is frmSitePractionerData and the subform is
frmSitePractitioner. The primary key for the subform (which is created in
the sub when the sub saves the record) goes in the field PractionerNum, which
is on the subform.
This is how it goes: frmSite (launches)-> frmAddFirstPractitioner
(launches) -> frmSitePractitionerData(Which contains frmSitePractitioner)
I keep getting Error 2109 "There is no field named DoCmd.GoToControl
"frmSitePractitionerData!practioner!practionerNum" in the current record".
I have tried the several ways to get to practionerNum but all the things
I've tried (listed below) have not worked.
Am I not referring to the control PractionerNum correctly?
Thanks-
Loralee
****************
Private Sub cmdAddFirst_Click()
Dim strLicense As String
Dim strFirstname As String
Dim strLastname As String
Dim intSiteID As Integer
Dim intPractNum As Integer
If ValidatePractitioner Then
strLicense = txtLicense
strFirstname = txtFirstName
strLastname = txtLastName
intSiteID = txtSiteID
If PractitionerNew(strLicense, strLastname, strFirstname, intSiteID)
= True Then'add new practitioner
MsgBox "Practitioner is new - add him"
Call AddNewPractitioner(strLicense, strLastname, strFirstname,
intSiteID)
DoCmd.OpenForm "frmSitePractionerData", , , "[SiteID]=" &
intSiteID ', , , txtnewpractionernum
' DoCmd.GoToControl "practionerNum" ' <- this works when
frmSitePractionerData is already open but bombs when coming from frmSite
' DoCmd.FindRecord txtNewPractionerNum <-temporarily commented
out but likely is really being omitted when run
----> DoCmd.GoToControl
"frmSitePractitionerData!frmSitePractitioner!practionerNum" <---------Error
2109 here
DoCmd.Close acForm, "frmaddfirstpractitioner", acSaveNo
Else
MsgBox "Practitioner is already in the database."
End If
End If
*************************
' DoCmd.GoToRecord acDataForm,
"Forms!frmsitepractionerdata!frmSitePractioner", acGoTo,
Me.txtNewPractionerNum
'above bombed saying frmSitePractionerData is not open when
opened as New Practitioner from add new practitioner
'DoCmd.GoToControl
"frmSitePractitionerData!practioner_Data.Form!practionerNum"
practioner_Data is the name of the subform control <- This causes error 2109
also
(txtNewPractionerNum is created by addNewPractitioner and is placed into a
txtbox on frmAddFirstPractitioner).
information from the user. When the user clicks the "okay" button on
frmAddFirstPractitioner, a sub saves the new record and launches another form
with a subform on it. I want the form/subform to open with the new record
open. The form that is launched is frmSitePractionerData and the subform is
frmSitePractitioner. The primary key for the subform (which is created in
the sub when the sub saves the record) goes in the field PractionerNum, which
is on the subform.
This is how it goes: frmSite (launches)-> frmAddFirstPractitioner
(launches) -> frmSitePractitionerData(Which contains frmSitePractitioner)
I keep getting Error 2109 "There is no field named DoCmd.GoToControl
"frmSitePractitionerData!practioner!practionerNum" in the current record".
I have tried the several ways to get to practionerNum but all the things
I've tried (listed below) have not worked.
Am I not referring to the control PractionerNum correctly?
Thanks-
Loralee
****************
Private Sub cmdAddFirst_Click()
Dim strLicense As String
Dim strFirstname As String
Dim strLastname As String
Dim intSiteID As Integer
Dim intPractNum As Integer
If ValidatePractitioner Then
strLicense = txtLicense
strFirstname = txtFirstName
strLastname = txtLastName
intSiteID = txtSiteID
If PractitionerNew(strLicense, strLastname, strFirstname, intSiteID)
= True Then'add new practitioner
MsgBox "Practitioner is new - add him"
Call AddNewPractitioner(strLicense, strLastname, strFirstname,
intSiteID)
DoCmd.OpenForm "frmSitePractionerData", , , "[SiteID]=" &
intSiteID ', , , txtnewpractionernum
' DoCmd.GoToControl "practionerNum" ' <- this works when
frmSitePractionerData is already open but bombs when coming from frmSite
' DoCmd.FindRecord txtNewPractionerNum <-temporarily commented
out but likely is really being omitted when run
----> DoCmd.GoToControl
"frmSitePractitionerData!frmSitePractitioner!practionerNum" <---------Error
2109 here
DoCmd.Close acForm, "frmaddfirstpractitioner", acSaveNo
Else
MsgBox "Practitioner is already in the database."
End If
End If
*************************
' DoCmd.GoToRecord acDataForm,
"Forms!frmsitepractionerdata!frmSitePractioner", acGoTo,
Me.txtNewPractionerNum
'above bombed saying frmSitePractionerData is not open when
opened as New Practitioner from add new practitioner
'DoCmd.GoToControl
"frmSitePractitionerData!practioner_Data.Form!practionerNum"
practioner_Data is the name of the subform control <- This causes error 2109
also
(txtNewPractionerNum is created by addNewPractitioner and is placed into a
txtbox on frmAddFirstPractitioner).