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
|
|||
|
|||
NotInList Event does not return to original record
I have the following written to the NotInList event to add a new name to a
combo box in a form: Option Compare Database Option Explicit Private Sub Combo16_NotInList(NewData As String, Response As Integer) Dim strMsg As String strMsg = "Add new field name?" If MsgBox(strMsg, vbYesNo) = vbYes Then 'open form and pass NewData DoCmd.OpenForm "frmField Info", , , , acFormAdd, acDialog, NewData Response = acDataErrAdded 'tell access to requery combo Else 'cancel even and undo typing Response = acDataErrContinue Me.Undo End If End Sub However, after I return from the referenced form "frmField Info" to the original form I am no longer on the same record. I have advanced to the next record with only the updated field on the preceding added record. Any suggestions on how to return to the correct record? Thanks! |
#2
|
|||
|
|||
NotInList Event does not return to original record
"khel" wrote:
I am no longer on the same record. DoCmd.OpenForm "frmField Info", , , , acFormAdd, acDialog, NewData acFormAdd - The user can add new records but can not edit existing records. HTH Richard "khel" wrote: I have the following written to the NotInList event to add a new name to a combo box in a form: Option Compare Database Option Explicit Private Sub Combo16_NotInList(NewData As String, Response As Integer) Dim strMsg As String strMsg = "Add new field name?" If MsgBox(strMsg, vbYesNo) = vbYes Then 'open form and pass NewData DoCmd.OpenForm "frmField Info", , , , acFormAdd, acDialog, NewData Response = acDataErrAdded 'tell access to requery combo Else 'cancel even and undo typing Response = acDataErrContinue Me.Undo End If End Sub However, after I return from the referenced form "frmField Info" to the original form I am no longer on the same record. I have advanced to the next record with only the updated field on the preceding added record. Any suggestions on how to return to the correct record? Thanks! |
#3
|
|||
|
|||
NotInList Event does not return to original record
Użytkownik "khel" napisał w wiadomości grup ... I have the following written to the NotInList event to add a new name to a combo box in a form: Option Compare Database Option Explicit Private Sub Combo16_NotInList(NewData As String, Response As Integer) Dim strMsg As String strMsg = "Add new field name?" If MsgBox(strMsg, vbYesNo) = vbYes Then 'open form and pass NewData DoCmd.OpenForm "frmField Info", , , , acFormAdd, acDialog, NewData Response = acDataErrAdded 'tell access to requery combo Else 'cancel even and undo typing Response = acDataErrContinue Me.Undo End If End Sub However, after I return from the referenced form "frmField Info" to the original form I am no longer on the same record. I have advanced to the next record with only the updated field on the preceding added record. Any suggestions on how to return to the correct record? Thanks! |
#4
|
|||
|
|||
NotInList Event does not return to original record
I thought acFormAdd was to add data to the referenced form to fill the info
in the combo box, not the "base form." I have a "base form," frmMonthly Purchaser Price Info which includes a combo box, Combo16. This combo box has a notinlist event that is listed below. The form, frmField Info, is opened with this event and new data is listed to populate the combo box on frmMonthly Purchaser. However, once returning to the "base form," frmMonthly Purchaser I am no longer on the record I was adding, I have advanced one record with only the information that I added from frmField Info on the preceding record. I would like to return to the original record that I was attempting to add on the base form, before I chose the notinlist event option of adding data to my combo box. I don't know if I have further confused the situation with my explanation. Thanks for your help. K "khel" wrote: I have the following written to the NotInList event to add a new name to a combo box in a form: Option Compare Database Option Explicit Private Sub Combo16_NotInList(NewData As String, Response As Integer) Dim strMsg As String strMsg = "Add new field name?" If MsgBox(strMsg, vbYesNo) = vbYes Then 'open form and pass NewData DoCmd.OpenForm "frmField Info", , , , acFormAdd, acDialog, NewData Response = acDataErrAdded 'tell access to requery combo Else 'cancel even and undo typing Response = acDataErrContinue Me.Undo End If End Sub However, after I return from the referenced form "frmField Info" to the original form I am no longer on the same record. I have advanced to the next record with only the updated field on the preceding added record. Any suggestions on how to return to the correct record? Thanks! |
#5
|
|||
|
|||
NotInList Event does not return to original record
Khel
This is where I found the info on "acformadd" http://www.blueclaw-db.com/docmd_openform_example.htm About half way down the page. Microsoft has a similar explaination in there kb. If it was me I would try and comment out that line and see what happens. Richard "khel" wrote: I thought acFormAdd was to add data to the referenced form to fill the info in the combo box, not the "base form." I have a "base form," frmMonthly Purchaser Price Info which includes a combo box, Combo16. This combo box has a notinlist event that is listed below. The form, frmField Info, is opened with this event and new data is listed to populate the combo box on frmMonthly Purchaser. However, once returning to the "base form," frmMonthly Purchaser I am no longer on the record I was adding, I have advanced one record with only the information that I added from frmField Info on the preceding record. I would like to return to the original record that I was attempting to add on the base form, before I chose the notinlist event option of adding data to my combo box. I don't know if I have further confused the situation with my explanation. Thanks for your help. K "khel" wrote: I have the following written to the NotInList event to add a new name to a combo box in a form: Option Compare Database Option Explicit Private Sub Combo16_NotInList(NewData As String, Response As Integer) Dim strMsg As String strMsg = "Add new field name?" If MsgBox(strMsg, vbYesNo) = vbYes Then 'open form and pass NewData DoCmd.OpenForm "frmField Info", , , , acFormAdd, acDialog, NewData Response = acDataErrAdded 'tell access to requery combo Else 'cancel even and undo typing Response = acDataErrContinue Me.Undo End If End Sub However, after I return from the referenced form "frmField Info" to the original form I am no longer on the same record. I have advanced to the next record with only the updated field on the preceding added record. Any suggestions on how to return to the correct record? Thanks! |
#6
|
|||
|
|||
NotInList Event does not return to original record
khel
He is some code from microsoft's "house hold inventory" template they use the NotInList function in the double click event. Private Sub CategoryID_DblClick(Cancel As Integer) On Error GoTo Err_CategoryID_DblClick Dim lngCategoryID As Long If IsNull(Me![CategoryID]) Then Me![CategoryID].Text = "" Else lngCategoryID = Me![CategoryID] Me![CategoryID] = Null End If DoCmd.OpenForm "Categories", , , , , acDialog, "GotoNew" Me![CategoryID].Requery If lngCategoryID 0 Then Me![CategoryID] = lngCategoryID Exit_CategoryID_DblClick: Exit Sub Err_CategoryID_DblClick: MsgBox Err.Description Resume Exit_CategoryID_DblClick End Sub notice no use of the acformadd ? take a look at this line. DoCmd.OpenForm "Categories", , , , , acDialog, "GotoNew" You may be able to use this in your project. HTH Richard "Richard" wrote: Khel This is where I found the info on "acformadd" http://www.blueclaw-db.com/docmd_openform_example.htm About half way down the page. Microsoft has a similar explaination in there kb. If it was me I would try and comment out that line and see what happens. Richard "khel" wrote: I thought acFormAdd was to add data to the referenced form to fill the info in the combo box, not the "base form." I have a "base form," frmMonthly Purchaser Price Info which includes a combo box, Combo16. This combo box has a notinlist event that is listed below. The form, frmField Info, is opened with this event and new data is listed to populate the combo box on frmMonthly Purchaser. However, once returning to the "base form," frmMonthly Purchaser I am no longer on the record I was adding, I have advanced one record with only the information that I added from frmField Info on the preceding record. I would like to return to the original record that I was attempting to add on the base form, before I chose the notinlist event option of adding data to my combo box. I don't know if I have further confused the situation with my explanation. Thanks for your help. K "khel" wrote: I have the following written to the NotInList event to add a new name to a combo box in a form: Option Compare Database Option Explicit Private Sub Combo16_NotInList(NewData As String, Response As Integer) Dim strMsg As String strMsg = "Add new field name?" If MsgBox(strMsg, vbYesNo) = vbYes Then 'open form and pass NewData DoCmd.OpenForm "frmField Info", , , , acFormAdd, acDialog, NewData Response = acDataErrAdded 'tell access to requery combo Else 'cancel even and undo typing Response = acDataErrContinue Me.Undo End If End Sub However, after I return from the referenced form "frmField Info" to the original form I am no longer on the same record. I have advanced to the next record with only the updated field on the preceding added record. Any suggestions on how to return to the correct record? Thanks! |
#7
|
|||
|
|||
NotInList Event does not return to original record
Thanks for all your help. I haven't tried the latest code that you sent,
but I'm beginning to wonder if it is a problem with my combo box. I have always used the cursor to select the correct data in the combo box and then selected the next field on the form with the cursor. If I use enter or tab it goes to the next record on the form. How do I correct that? Again, thanks for your suggestions! K "Richard" wrote: khel He is some code from microsoft's "house hold inventory" template they use the NotInList function in the double click event. Private Sub CategoryID_DblClick(Cancel As Integer) On Error GoTo Err_CategoryID_DblClick Dim lngCategoryID As Long If IsNull(Me![CategoryID]) Then Me![CategoryID].Text = "" Else lngCategoryID = Me![CategoryID] Me![CategoryID] = Null End If DoCmd.OpenForm "Categories", , , , , acDialog, "GotoNew" Me![CategoryID].Requery If lngCategoryID 0 Then Me![CategoryID] = lngCategoryID Exit_CategoryID_DblClick: Exit Sub Err_CategoryID_DblClick: MsgBox Err.Description Resume Exit_CategoryID_DblClick End Sub notice no use of the acformadd ? take a look at this line. DoCmd.OpenForm "Categories", , , , , acDialog, "GotoNew" You may be able to use this in your project. HTH Richard "Richard" wrote: Khel This is where I found the info on "acformadd" http://www.blueclaw-db.com/docmd_openform_example.htm About half way down the page. Microsoft has a similar explaination in there kb. If it was me I would try and comment out that line and see what happens. Richard "khel" wrote: I thought acFormAdd was to add data to the referenced form to fill the info in the combo box, not the "base form." I have a "base form," frmMonthly Purchaser Price Info which includes a combo box, Combo16. This combo box has a notinlist event that is listed below. The form, frmField Info, is opened with this event and new data is listed to populate the combo box on frmMonthly Purchaser. However, once returning to the "base form," frmMonthly Purchaser I am no longer on the record I was adding, I have advanced one record with only the information that I added from frmField Info on the preceding record. I would like to return to the original record that I was attempting to add on the base form, before I chose the notinlist event option of adding data to my combo box. I don't know if I have further confused the situation with my explanation. Thanks for your help. K "khel" wrote: I have the following written to the NotInList event to add a new name to a combo box in a form: Option Compare Database Option Explicit Private Sub Combo16_NotInList(NewData As String, Response As Integer) Dim strMsg As String strMsg = "Add new field name?" If MsgBox(strMsg, vbYesNo) = vbYes Then 'open form and pass NewData DoCmd.OpenForm "frmField Info", , , , acFormAdd, acDialog, NewData Response = acDataErrAdded 'tell access to requery combo Else 'cancel even and undo typing Response = acDataErrContinue Me.Undo End If End Sub However, after I return from the referenced form "frmField Info" to the original form I am no longer on the same record. I have advanced to the next record with only the updated field on the preceding added record. Any suggestions on how to return to the correct record? Thanks! |
#8
|
|||
|
|||
NotInList Event does not return to original record
Look in tools options keyboard
Richard "khel" wrote: Thanks for all your help. I haven't tried the latest code that you sent, but I'm beginning to wonder if it is a problem with my combo box. I have always used the cursor to select the correct data in the combo box and then selected the next field on the form with the cursor. If I use enter or tab it goes to the next record on the form. How do I correct that? Again, thanks for your suggestions! K "Richard" wrote: khel He is some code from microsoft's "house hold inventory" template they use the NotInList function in the double click event. Private Sub CategoryID_DblClick(Cancel As Integer) On Error GoTo Err_CategoryID_DblClick Dim lngCategoryID As Long If IsNull(Me![CategoryID]) Then Me![CategoryID].Text = "" Else lngCategoryID = Me![CategoryID] Me![CategoryID] = Null End If DoCmd.OpenForm "Categories", , , , , acDialog, "GotoNew" Me![CategoryID].Requery If lngCategoryID 0 Then Me![CategoryID] = lngCategoryID Exit_CategoryID_DblClick: Exit Sub Err_CategoryID_DblClick: MsgBox Err.Description Resume Exit_CategoryID_DblClick End Sub notice no use of the acformadd ? take a look at this line. DoCmd.OpenForm "Categories", , , , , acDialog, "GotoNew" You may be able to use this in your project. HTH Richard "Richard" wrote: Khel This is where I found the info on "acformadd" http://www.blueclaw-db.com/docmd_openform_example.htm About half way down the page. Microsoft has a similar explaination in there kb. If it was me I would try and comment out that line and see what happens. Richard "khel" wrote: I thought acFormAdd was to add data to the referenced form to fill the info in the combo box, not the "base form." I have a "base form," frmMonthly Purchaser Price Info which includes a combo box, Combo16. This combo box has a notinlist event that is listed below. The form, frmField Info, is opened with this event and new data is listed to populate the combo box on frmMonthly Purchaser. However, once returning to the "base form," frmMonthly Purchaser I am no longer on the record I was adding, I have advanced one record with only the information that I added from frmField Info on the preceding record. I would like to return to the original record that I was attempting to add on the base form, before I chose the notinlist event option of adding data to my combo box. I don't know if I have further confused the situation with my explanation. Thanks for your help. K "khel" wrote: I have the following written to the NotInList event to add a new name to a combo box in a form: Option Compare Database Option Explicit Private Sub Combo16_NotInList(NewData As String, Response As Integer) Dim strMsg As String strMsg = "Add new field name?" If MsgBox(strMsg, vbYesNo) = vbYes Then 'open form and pass NewData DoCmd.OpenForm "frmField Info", , , , acFormAdd, acDialog, NewData Response = acDataErrAdded 'tell access to requery combo Else 'cancel even and undo typing Response = acDataErrContinue Me.Undo End If End Sub However, after I return from the referenced form "frmField Info" to the original form I am no longer on the same record. I have advanced to the next record with only the updated field on the preceding added record. Any suggestions on how to return to the correct record? Thanks! |
Thread Tools | |
Display Modes | |
|
|