G
Guest
Hello all! I've read a couple of hundred posts pertaining to my dilemma, but
keep falling short of getting it all to work together. I have a subform,
PartsUsed, inside of my DispositionEntries form. It contains a Cbo called
PartNumber with 2 columns, but displaying only the (0) column. The second
column populates the second field using the AfterUpdate event of the first
field, (Me.Description=Me.PartNumber.Column(1)
There will be frequent parts added and so I used the NotInList event of the
PartNumber field to open up a new dialog, AddPartNumber, which I then add my
"Description" info into and save and close. This does bring me back to my
original form, but it then asks if I want to add the part number again. I've
tried a couple of requery attempts, i.e.,
Forms!MainFormName!SubFormName!ComboBoxName.Requery,
in the OnClose event of my dialog box which I got from another post, but it
refuses, telling me I must save the current field first. I saved it every
way I could think of, but keep receiving the same error. The data is being
saved correctly to my lookup table, but not to my PartsUsed table. Here is
my NotInList code:
Private Sub PartNumber_NotInList(NewData As String, Response As Integer)
On Error GoTo Err_Label
Dim strMessage As String
Dim strFormName As String
DoCmd.Save
strMessage = "Part Number: '" & UCase$(NewData) & "' is not in the list. " &
vbCrLf & "Would you like to add it?"
If MsgBox(strMessage, vbYesNo + vbQuestion, "Add New Part") = vbYes Then
strFormName = "AddPartNumber"
DoCmd.OpenForm strFormName, acNormal, , , acFormAdd, acDialog, UCase$(NewData)
Response = acDataErrAdd
Else
Response = acDataErrContinue
End If
Exit_Label:
Exit Sub
Err_Label:
MsgBox Err.Description
Resume Exit_Label
End Sub
This came from a post here also, but note that the Else statement does not
work and what I am actually using I had to remove the Else, End If and
Response = acDataErrAdd. I don't really understand some of the functionality
of the responses, but it was the only way I could get it to work at all. I
noted in a post that I was not alone in this, but there was no solution
forthcoming in that one.
Any ideas on how to get me off the horns of my dilemma??!! Thanks in advance!
keep falling short of getting it all to work together. I have a subform,
PartsUsed, inside of my DispositionEntries form. It contains a Cbo called
PartNumber with 2 columns, but displaying only the (0) column. The second
column populates the second field using the AfterUpdate event of the first
field, (Me.Description=Me.PartNumber.Column(1)
There will be frequent parts added and so I used the NotInList event of the
PartNumber field to open up a new dialog, AddPartNumber, which I then add my
"Description" info into and save and close. This does bring me back to my
original form, but it then asks if I want to add the part number again. I've
tried a couple of requery attempts, i.e.,
Forms!MainFormName!SubFormName!ComboBoxName.Requery,
in the OnClose event of my dialog box which I got from another post, but it
refuses, telling me I must save the current field first. I saved it every
way I could think of, but keep receiving the same error. The data is being
saved correctly to my lookup table, but not to my PartsUsed table. Here is
my NotInList code:
Private Sub PartNumber_NotInList(NewData As String, Response As Integer)
On Error GoTo Err_Label
Dim strMessage As String
Dim strFormName As String
DoCmd.Save
strMessage = "Part Number: '" & UCase$(NewData) & "' is not in the list. " &
vbCrLf & "Would you like to add it?"
If MsgBox(strMessage, vbYesNo + vbQuestion, "Add New Part") = vbYes Then
strFormName = "AddPartNumber"
DoCmd.OpenForm strFormName, acNormal, , , acFormAdd, acDialog, UCase$(NewData)
Response = acDataErrAdd
Else
Response = acDataErrContinue
End If
Exit_Label:
Exit Sub
Err_Label:
MsgBox Err.Description
Resume Exit_Label
End Sub
This came from a post here also, but note that the Else statement does not
work and what I am actually using I had to remove the Else, End If and
Response = acDataErrAdd. I don't really understand some of the functionality
of the responses, but it was the only way I could get it to work at all. I
noted in a post that I was not alone in this, but there was no solution
forthcoming in that one.
Any ideas on how to get me off the horns of my dilemma??!! Thanks in advance!