Rich_Lovina
Registered User.
- Local time
- Tomorrow, 08:55
- Joined
- Feb 27, 2002
- Messages
- 224
I have a form trying to add a new Position Code for a Title (Form called QryInputForm has the field Poscode. I have a related form Posform (Flds: Psncode,Title), and here's the script Ive been working with for 30 hours:
Private Sub Poscodes_NotInList(NewData As String, Response As Integer)
Dim Result
Dim Msg As String
Dim CR As String
CR = Chr$(13)
' Exit this subroutine if the combo box was cleared.
If NewData = "" Then Exit Sub
' Ask the user if he or she wishes to add a new PosCode.
Msg = "'" & NewData & "' is not in the list." & CR & CR
Msg = Msg & "Do you want to add new PosCode?"
If MsgBox(Msg, vbQuestion + vbYesNo) = vbYes Then
' If the user chose Yes, start the PosForm in data entry
' mode as a dialog form, passing the new PsnCode name in
' NewData to the OpenForm method's OpenArgs argument. The
' OpenArgs argument is used in PosForm's Form_Load event
' procedure.
DoCmd.OpenForm "PosForm", , , , acAdd, acDialog, NewData
End If
' Look for the PosCode the user created in the InputForm.
Result = DLookup("[Psncode]", "QryInputForm", "[Title]='" & NewData & "'")
If IsNull(Result) Then
' If the PosCode was not created, set the Response argument
' to suppress an error message and undo changes.
Response = acDataErrContinue
' Display a customized message.
MsgBox "Please try again!"
Else
' If the PosCode was created, set the Response argument to
' indicate that new data is being added.
Response = acDataErrAdded
End If
End Sub
And this is the script from the PosForm:
Private Sub Form_Load()
If Not IsNull(Me.OpenArgs) Then
' If form's OpenArgs property has a value, assign the contents
' of OpenArgs to the Title field. OpenArgs will contain
' a Title name if this form is opened using the OpenForm
' method with an OpenArgs argument, as done in the InputForm's
' Poscodes_NotInList event procedure.
Me![Psncode] = Me.OpenArgs
End If
End Sub
My problem is I keep getting the Error Code 3078...Cannot find the Inputform or query 'QryInputForm'. The debug line highlights DLookup line.
Maybe someone can see the simple solution....Tks in advance.
Private Sub Poscodes_NotInList(NewData As String, Response As Integer)
Dim Result
Dim Msg As String
Dim CR As String
CR = Chr$(13)
' Exit this subroutine if the combo box was cleared.
If NewData = "" Then Exit Sub
' Ask the user if he or she wishes to add a new PosCode.
Msg = "'" & NewData & "' is not in the list." & CR & CR
Msg = Msg & "Do you want to add new PosCode?"
If MsgBox(Msg, vbQuestion + vbYesNo) = vbYes Then
' If the user chose Yes, start the PosForm in data entry
' mode as a dialog form, passing the new PsnCode name in
' NewData to the OpenForm method's OpenArgs argument. The
' OpenArgs argument is used in PosForm's Form_Load event
' procedure.
DoCmd.OpenForm "PosForm", , , , acAdd, acDialog, NewData
End If
' Look for the PosCode the user created in the InputForm.
Result = DLookup("[Psncode]", "QryInputForm", "[Title]='" & NewData & "'")
If IsNull(Result) Then
' If the PosCode was not created, set the Response argument
' to suppress an error message and undo changes.
Response = acDataErrContinue
' Display a customized message.
MsgBox "Please try again!"
Else
' If the PosCode was created, set the Response argument to
' indicate that new data is being added.
Response = acDataErrAdded
End If
End Sub
And this is the script from the PosForm:
Private Sub Form_Load()
If Not IsNull(Me.OpenArgs) Then
' If form's OpenArgs property has a value, assign the contents
' of OpenArgs to the Title field. OpenArgs will contain
' a Title name if this form is opened using the OpenForm
' method with an OpenArgs argument, as done in the InputForm's
' Poscodes_NotInList event procedure.
Me![Psncode] = Me.OpenArgs
End If
End Sub
My problem is I keep getting the Error Code 3078...Cannot find the Inputform or query 'QryInputForm'. The debug line highlights DLookup line.
Maybe someone can see the simple solution....Tks in advance.