MS ACCESS PROBZZZ
Registered User.
- Local time
- Today, 13:27
- Joined
- Jun 12, 2018
- Messages
- 29
Hello!
I need some help reducing the number of clicks it takes to get to the center of the Access pop.
I am using an Edit List Form but find the user experience unsatisfactory. The ghosted button is difficult to see and the location is awkward. I also don't like that once I've entered the new item and return to the original form, I have to then scroll through a long list to find the thing I just typed. Not very efficient. The new data should be passed from the Edit List Form to the original form field to automate the tedium.
I've been trying to solve this with the On Not In List Event. I like this in concept because I can type my new data in the original form and pressing enter will trigger the Not In List event.
However the text that I just worked so hard to type in the field should be passed to the related field in the launched edit form. Right now that's not happening. Additionally, when I return to the original form, the list does not update. (I get an error message that goes to this line: Me!Publication_IDFK = Me!txtNewPublication) It is added to the correct table but I have to close and reopen the form to see the new value appear in the combobox list.
Here's the code I'm using. I can't remember who the original author is. I do know I've tried multiple peoples code for this though.
*I have a hidden text box called txtNewPublication on the original form. I still don't understand the black magic behind why this is necessary though. I don't understand why the model is to set a form control equal to another control on the same form; as in Me!Publication_IDFK = Me!txtNewPublication. Why not something like Me!Publication_IDFK = [Forms]![Frm_PublicationEntry]![Publication_ID]??
I need some help reducing the number of clicks it takes to get to the center of the Access pop.
I am using an Edit List Form but find the user experience unsatisfactory. The ghosted button is difficult to see and the location is awkward. I also don't like that once I've entered the new item and return to the original form, I have to then scroll through a long list to find the thing I just typed. Not very efficient. The new data should be passed from the Edit List Form to the original form field to automate the tedium.
I've been trying to solve this with the On Not In List Event. I like this in concept because I can type my new data in the original form and pressing enter will trigger the Not In List event.
However the text that I just worked so hard to type in the field should be passed to the related field in the launched edit form. Right now that's not happening. Additionally, when I return to the original form, the list does not update. (I get an error message that goes to this line: Me!Publication_IDFK = Me!txtNewPublication) It is added to the correct table but I have to close and reopen the form to see the new value appear in the combobox list.
Here's the code I'm using. I can't remember who the original author is. I do know I've tried multiple peoples code for this though.
*I have a hidden text box called txtNewPublication on the original form. I still don't understand the black magic behind why this is necessary though. I don't understand why the model is to set a form control equal to another control on the same form; as in Me!Publication_IDFK = Me!txtNewPublication. Why not something like Me!Publication_IDFK = [Forms]![Frm_PublicationEntry]![Publication_ID]??
Code:
Private Sub Publication_IDFK_NotInList(NewData As String, Response As Integer)
'* ask if the user want to add this Publication
If MsgBox("Do you want to add " & Chr(34) & NewData & Chr(34) & _
" to Publications?", vbQuestion + vbYesNo) = vbNo Then
'* doesn't want to add this
Response = acDataErrContinue
'* clear the combo
Me.Publication_IDFK.Value = ""
SendKeys "{ESC}"
Else
'* This is a new Unbound textbox I made.
'* It will contain the actual Publication_ID
'* If Frm_PublicationEntry Saved and Closed
Me!txtNewPublication = Null
'* Yes, open Frm_PublicationEntry form
DoCmd.OpenForm FormName:="Frm_PublicationEntry", View:=acNormal, WindowMode:=acDialog, OpenArgs:=NewData
'* Frm_PublicationEntry will set [txtUnbound] to True
'* if it click the Save And Close button on that form
'* then when this happens we are sure that the NewData
'* was already added to the Table and the the Combobox
If IsNull(Me!txtNewPublication) = False Then
Response = acDataErrAdded
'* get the new Publication from Unbound Textbox
Me!Publication_IDFK = Me!txtNewPublication
Else
'* user did not save the NewData
Response = acDataErrContinue
'* clear the combo
Me.Publication_IDFK.Value = ""
SendKeys "{ESC}"
End If
End If
'* set Focus to the combobox
Me.Publication_IDFK.SetFocus
End Sub