Hello, i have a problem, and i am stuck. Sorry if this seems a bit easy- but i am new to access.
I have a combobox, and i have it get information from another form AfterUpdate. However, if the item is not in the list, then i want it to open another form to input the data- then go back to the original form (easy enough to do). My problem is that AfterUpdate takes precidence over NotInList. If the item isn't in the list, then it gives an error of "you entered an expression with no value" - which i took to mean Null (even tried "" just in case). I have tried if statements in every way i can think of to get it to work how i want... to no avail. here is the code from my after update on frm_AFREP_order
it opens the other form (frm_get_info_order)
here is the sub to open the info input form on NotInList (doesn't work)
Here are some of the things i tried:
(frm_get_info_order)
(named PNOMEN in frm_AFREP_order)
Another attempt:
i also replaced "null" with "" just in case, and i used an elseif statement as well- just in case. If i am missing something, please let me know.
If you could, pease help me figure out how to make this work. All help is very much appreciated.
I have a combobox, and i have it get information from another form AfterUpdate. However, if the item is not in the list, then i want it to open another form to input the data- then go back to the original form (easy enough to do). My problem is that AfterUpdate takes precidence over NotInList. If the item isn't in the list, then it gives an error of "you entered an expression with no value" - which i took to mean Null (even tried "" just in case). I have tried if statements in every way i can think of to get it to work how i want... to no avail. here is the code from my after update on frm_AFREP_order
Code:
Private Sub Combo116_AfterUpdate()
DoCmd.OpenForm "frm_get_info_order", acNormal, , , acFormReadOnly
DoCmd.Close acForm, "frm_get_info_order", acSaveYes
Me.NSN.Value = PNSN
Me.Part__.Value = PPN
Me.UI.Value = PUI
Me.WUC.Value = PWUC
Me.NHA.Value = PNHA
Me.NHASN.Value = PNHASN
Me.TO.Value = PTO
Me.Fig.Value = PFIG
Me.IND.Value = PIND
Me.Text157.Value = PCOST
Me.Nomen.Value = Me.Combo116.Value
End Sub
it opens the other form (frm_get_info_order)
Code:
Private Sub Form_Load()
PNSN = Me.NSN.Value
PPN = Me.Part_Num.Value
PUI = Me.UI.Value
PWUC = Me.WUC.Value
PNHA = Me.NHA.Value
PNHASN = Me.NHASN.Value
PTO = Me.TO.Value
PFIG = Me.Fig.Value
PIND = Me.IND.Value
PCOST = Me.Text32.Value
End Sub
here is the sub to open the info input form on NotInList (doesn't work)
Code:
Private Sub Combo116_NotInList(NewData As String, Response As Integer)
DoCmd.OpenForm "frm_new_item_order", acNormal, , , , acWindowNormal
DoCmd.Close acForm
End Sub
Here are some of the things i tried:
(frm_get_info_order)
Code:
Private Sub Form_Load()
If Me.Item_Name = PNOMEN Then
PNSN = Me.NSN.Value
PPN = Me.Part_Num.Value
PUI = Me.UI.Value
PWUC = Me.WUC.Value
PNHA = Me.NHA.Value
PNHASN = Me.NHASN.Value
PTO = Me.TO.Value
PFIG = Me.Fig.Value
PIND = Me.IND.Value
PCOST = Me.Text32.Value
Else
DoCmd.OpenForm "frm_new_item_order", acNormal, , , , acWindowNormal
MsgBox "Item not loaded. Input new item now", vbOKOnly
end if
End Sub
Another attempt:
Code:
Private Sub Form_Load()
If Me.Item_Name = Null Then
DoCmd.OpenForm "frm_new_item_order", acNormal, , , , acWindowNormal
MsgBox "Item not loaded. Input new item now", vbOKOnly
Else
PNSN = Me.NSN.Value
PPN = Me.Part_Num.Value
PUI = Me.UI.Value
PWUC = Me.WUC.Value
PNHA = Me.NHA.Value
PNHASN = Me.NHASN.Value
PTO = Me.TO.Value
PFIG = Me.Fig.Value
PIND = Me.IND.Value
PCOST = Me.Text32.Value
End If
End Sub
If you could, pease help me figure out how to make this work. All help is very much appreciated.