If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
From Form to Form
I am having a problem switching from one form to another from a prompt. Here
is my problem: I have an Invoice Form with a Customer Field (combo box) that looks up CompanyName from a Customer Table, if the CompanyName is not in the Customer Table then user is prompted [“NewData” is not an available Company Name! Do you want to add it? Click yes to add it or No to re-type it.] If no is clicked user returns to Invoice Form to renter the name, if yes is clicked CompanyName field is cleared, the Invoice Form is closed, and the Customer Form is opened. The problem is when the Customer Form is opened I get the following error: [The text you entered isn’t an item in the list. Select an item from the list, or enter text that matches one of the list items.] How can I keep this error from showing up when the Customer Form is opened? Thank you in advance KB -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200508/1 |
#2
|
|||
|
|||
On Tue, 23 Aug 2005 14:23:57 GMT, "BabyATX13 via AccessMonster.com"
wrote: I am having a problem switching from one form to another from a prompt. Here is my problem: I have an Invoice Form with a Customer Field (combo box) that looks up CompanyName from a Customer Table, if the CompanyName is not in the Customer Table then user is prompted [“NewData” is not an available Company Name! Do you want to add it? Click yes to add it or No to re-type it.] If no is clicked user returns to Invoice Form to renter the name, if yes is clicked CompanyName field is cleared, the Invoice Form is closed, and the Customer Form is opened. The problem is when the Customer Form is opened I get the following error: [The text you entered isn’t an item in the list. Select an item from the list, or enter text that matches one of the list items.] How can I keep this error from showing up when the Customer Form is opened? Thank you in advance KB Why are you closing the "Invoice" Form? Why are you clearing the CompanyName field? You want to get back there when the Customer form is complete don't you? Just open the Customer form as acDialog. Post your "NotInList" code and we'll make the adjustments to eliminate the error. _______________________________________________ hth - RuralGuy (RG for short) Please post to the NewsGroup so all may benefit. |
#3
|
|||
|
|||
RG,
Some answers: Why are you closing the "Invoice" Form? Because if I don’t the CompanyName field will not update until I do. Why are you clearing the CompanyName field? Because if I don’t I get the prompt twice. Just open the Customer form as acDialog. Forgive my ignorance, but, how? RuralGuy wrote: Why are you closing the "Invoice" Form? Why are you clearing the CompanyName field? You want to get back there when the Customer form is complete don't you? Just open the Customer form as acDialog. Post your "NotInList" code and we'll make the adjustments to eliminate the error. _______________________________________________ hth - RuralGuy (RG for short) Please post to the NewsGroup so all may benefit. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200508/1 |
#4
|
|||
|
|||
From VBA Help:
DoCmd.OpenForm(FormName, View, FilterName, WhereCondition, DataMode, WindowMode, OpenArgs) If WindowMode = acDialog then execution halts in this form until the next form is closed or made invisible. Are you opening the Customer form in the "NotInList" event? If so then please post that code from Private Sub ... End Sub On Tue, 23 Aug 2005 18:25:04 GMT, "BabyATX13 via AccessMonster.com" wrote: RG, Some answers: Why are you closing the "Invoice" Form? Because if I don’t the CompanyName field will not update until I do. Why are you clearing the CompanyName field? Because if I don’t I get the prompt twice. Just open the Customer form as acDialog. Forgive my ignorance, but, how? RuralGuy wrote: Why are you closing the "Invoice" Form? Why are you clearing the CompanyName field? You want to get back there when the Customer form is complete don't you? Just open the Customer form as acDialog. Post your "NotInList" code and we'll make the adjustments to eliminate the error. ______________________________________________ _ hth - RuralGuy (RG for short) Please post to the NewsGroup so all may benefit. _______________________________________________ hth - RuralGuy (RG for short) Please post to the NewsGroup so all may benefit. |
#5
|
|||
|
|||
My Original Code:
Private Sub CompanyName_NotInList(NewData As String, Response As Integer) 'Adds item to list Dim strMsg As String Dim stDocName As String Dim stLinkCriteria As String 'Display system message strMsg = "'" & NewData & "' is not an available Company Name!" & vbCrLf & vbCrLf strMsg = strMsg & "Do you want to add it?" strMsg = strMsg & vbCrLf & vbCrLf & "Click Yes to add it or No to re-type it." If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new name?") = vbNo Then Response = acDataErrContinue Else 'Clear CompanyName Field CompanyName.Undo 'Close the form Call Exit_Click 'Open the Customer Form in add mode stDocName = "Customers" DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd If Err Then MsgBox "An error occurred. Please try again." Response = acDataErrContinue Else Response = acDataErrAdded End If End If End Sub RuralGuy wrote: From VBA Help: DoCmd.OpenForm(FormName, View, FilterName, WhereCondition, DataMode, WindowMode, OpenArgs) If WindowMode = acDialog then execution halts in this form until the next form is closed or made invisible. Are you opening the Customer form in the "NotInList" event? If so then please post that code from Private Sub ... End Sub _______________________________________________ hth - RuralGuy (RG for short) Please post to the NewsGroup so all may benefit. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200508/1 |
#6
|
|||
|
|||
I found this particular piece of code and I wasn't sure what went where.
KB RuralGuy wrote: From VBA Help: DoCmd.OpenForm(FormName, View, FilterName, WhereCondition, DataMode, WindowMode, OpenArgs) -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200508/1 |
#7
|
|||
|
|||
Changes in line:
On Wed, 24 Aug 2005 13:59:59 GMT, "BabyATX13 via AccessMonster.com" wrote: My Original Code: Private Sub CompanyName_NotInList(NewData As String, Response As Integer) 'Adds item to list Dim strMsg As String Dim stDocName As String Dim stLinkCriteria As String 'Display system message strMsg = "'" & NewData & "' is not an available Company Name!" & vbCrLf & vbCrLf strMsg = strMsg & "Do you want to add it?" strMsg = strMsg & vbCrLf & vbCrLf & "Click Yes to add it or No to re-type it." If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new name?") = vbNo Then Response = acDataErrContinue Else '-- Don't do either of the next two lines of code! 'Clear CompanyName Field '-- CompanyName.Undo 'Close the form '-- Call Exit_Click 'Open the Customer Form in add mode stDocName = "Customers" DoCmd.OpenForm stDocName, , , , acFormAdd, acDialog, NewData '-- Unnecessary If...Else...End If now '-- If Err Then '-- MsgBox "An error occurred. Please try again." '-- Response = acDataErrContinue '-- Else '-- But you need this line so the ComboBox will requery. Response = acDataErrAdded '-- End If End If End Sub Then on the Open event of the "Customers" form you have something like: If Not IsNull(Me.OpenArgs) Then '-- Form is being opened from a form passing the New Customer Name txtCustomerName = Me.OpenArgs '-- Initialize the Customer Name End If Use *your* control names but that should give you the idea and eliminate all of your errors. Post back if you have additional questions or problems. You will no longer need a "New Customer" button! RuralGuy wrote: From VBA Help: DoCmd.OpenForm(FormName, View, FilterName, WhereCondition, DataMode, WindowMode, OpenArgs) If WindowMode = acDialog then execution halts in this form until the next form is closed or made invisible. Are you opening the Customer form in the "NotInList" event? If so then please post that code from Private Sub ... End Sub ______________________________________________ _ hth - RuralGuy (RG for short) Please post to the NewsGroup so all may benefit. _______________________________________________ hth - RuralGuy (RG for short) Please post to the NewsGroup so all may benefit. |
#8
|
|||
|
|||
Hu?????
RuralGuy wrote: '-- Unnecessary If...Else...End If now '-- If Err Then '-- MsgBox "An error occurred. Please try again." '-- Response = acDataErrContinue '-- Else '-- But you need this line so the ComboBox will requery. Response = acDataErrAdded '-- End If End If End Sub -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200508/1 |
#9
|
|||
|
|||
RuralGuy wrote:
Changes in line: I don't understand what you mean here '-- Unnecessary If...Else...End If now '-- If Err Then '-- MsgBox "An error occurred. Please try again." '-- Response = acDataErrContinue '-- Else '-- But you need this line so the ComboBox will requery. Response = acDataErrAdded '-- End If End If End Sub Then on the Open event of the "Customers" form you have something like: If Not IsNull(Me.OpenArgs) Then '-- Form is being opened from a form passing the New Customer Name txtCustomerName = Me.OpenArgs '-- Initialize the Customer Name End If I tried this code every which way I could think of and nothing worked the way it is supposed to work and I am still getting the error [The text you entered isn’t an item in the list. Select an item from the list, or enter text that matches one of the list items.] when the customer form opens. KB Use *your* control names but that should give you the idea and eliminate all of your errors. Post back if you have additional questions or problems. You will no longer need a "New Customer" button! From VBA Help: DoCmd.OpenForm(FormName, View, FilterName, WhereCondition, DataMode, [quoted text clipped - 9 lines] hth - RuralGuy (RG for short) Please post to the NewsGroup so all may benefit. _______________________________________________ hth - RuralGuy (RG for short) Please post to the NewsGroup so all may benefit. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200508/1 |
#10
|
|||
|
|||
RuralGuy wrote:
Changes in line: I don't understand what you mean here '-- Unnecessary If...Else...End If now '-- If Err Then '-- MsgBox "An error occurred. Please try again." '-- Response = acDataErrContinue '-- Else '-- But you need this line so the ComboBox will requery. Response = acDataErrAdded '-- End If End If End Sub Then on the Open event of the "Customers" form you have something like: If Not IsNull(Me.OpenArgs) Then '-- Form is being opened from a form passing the New Customer Name txtCustomerName = Me.OpenArgs '-- Initialize the Customer Name End If I tried this code every which way I could think of and nothing worked the way it is supposed to work and I am still getting the error [The text you entered isn’t an item in the list. Select an item from the list, or enter text that matches one of the list items.] when the customer form opens. KB Use *your* control names but that should give you the idea and eliminate all of your errors. Post back if you have additional questions or problems. You will no longer need a "New Customer" button! From VBA Help: DoCmd.OpenForm(FormName, View, FilterName, WhereCondition, DataMode, [quoted text clipped - 9 lines] hth - RuralGuy (RG for short) Please post to the NewsGroup so all may benefit. _______________________________________________ hth - RuralGuy (RG for short) Please post to the NewsGroup so all may benefit. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200508/1 |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Access Mail Merge to Word.doc files ? | RNUSZ@OKDPS | Setting Up & Running Reports | 1 | May 18th, 2005 06:31 PM |
Need Help In Printing Current Record in Specific Report | RNUSZ@OKDPS | Setting Up & Running Reports | 1 | May 16th, 2005 09:06 PM |
Dates in a listbox connected to a form... | RusCat | Using Forms | 13 | November 25th, 2004 02:31 AM |
auto entry into second table after update | Tony | New Users | 13 | July 9th, 2004 10:42 PM |
synchronizing form and list box | Deb Smith | Using Forms | 8 | June 21st, 2004 08:15 PM |