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
|
|||
|
|||
combobox & Subform
Hi,
I'm having trouble with this. I found a previous post and thought I had the answer but am still having trouble. I have an unbound combobox looking up a list. Once a selection is made I have code to pull the value of the unbound combobox into a bound textbox. This much works. When I change the combobox value the textbox changes approriately. I have a sub form to display all of the related information to the choice on the list. The subform has parent link and child link set to the bound value of the text box. My problem is the sub form does not update to reflect the change. Also, when I try to go to design mode or close the form I get an error message it can't be saved because it would create duplicate index, primary key, etc. Option Compare Database Private Sub cboMovieTitle_AfterUpdate() Me.txtmovieID = Me.cboMovieTitle End Sub since it wasn't updating, I tried this... added to movieID on query [forms]![frmEditMovies]![txtmovieID] code Private Sub txtmovieID_Change() Me.Requery End Sub -- Thanks for your help. Karen53 |
#2
|
|||
|
|||
combobox & Subform
Hi,
Never mind. I got it. -- Thanks for your help. Karen53 "Karen53" wrote: Hi, I'm having trouble with this. I found a previous post and thought I had the answer but am still having trouble. I have an unbound combobox looking up a list. Once a selection is made I have code to pull the value of the unbound combobox into a bound textbox. This much works. When I change the combobox value the textbox changes approriately. I have a sub form to display all of the related information to the choice on the list. The subform has parent link and child link set to the bound value of the text box. My problem is the sub form does not update to reflect the change. Also, when I try to go to design mode or close the form I get an error message it can't be saved because it would create duplicate index, primary key, etc. Option Compare Database Private Sub cboMovieTitle_AfterUpdate() Me.txtmovieID = Me.cboMovieTitle End Sub since it wasn't updating, I tried this... added to movieID on query [forms]![frmEditMovies]![txtmovieID] code Private Sub txtmovieID_Change() Me.Requery End Sub -- Thanks for your help. Karen53 |
#3
|
|||
|
|||
combobox & Subform
Hi,
No, I got it to work all on one form but how do I link it to a sub form? -- Thanks for your help. Karen53 "Karen53" wrote: Hi, I'm having trouble with this. I found a previous post and thought I had the answer but am still having trouble. I have an unbound combobox looking up a list. Once a selection is made I have code to pull the value of the unbound combobox into a bound textbox. This much works. When I change the combobox value the textbox changes approriately. I have a sub form to display all of the related information to the choice on the list. The subform has parent link and child link set to the bound value of the text box. My problem is the sub form does not update to reflect the change. Also, when I try to go to design mode or close the form I get an error message it can't be saved because it would create duplicate index, primary key, etc. Option Compare Database Private Sub cboMovieTitle_AfterUpdate() Me.txtmovieID = Me.cboMovieTitle End Sub since it wasn't updating, I tried this... added to movieID on query [forms]![frmEditMovies]![txtmovieID] code Private Sub txtmovieID_Change() Me.Requery End Sub -- Thanks for your help. Karen53 |
#4
|
|||
|
|||
combobox & Subform
What are you trying to do? If you're trying to find a record on your form
based on the value selected in the combo box, then you're going about it the wrong way. You don't want to actually change the value of the bound MovieID text box, you just want to *find* the record with the matching ID. The After Update event of your combo box should have code like this; With Me.RecordsetClone .FindFirst "[MovieID]=" & Me.YourComboBox If Not .NoMatch Then Me.Bookmark = .Bookmark End If End With -- _________ Sean Bailey "Karen53" wrote: Hi, No, I got it to work all on one form but how do I link it to a sub form? -- Thanks for your help. Karen53 "Karen53" wrote: Hi, I'm having trouble with this. I found a previous post and thought I had the answer but am still having trouble. I have an unbound combobox looking up a list. Once a selection is made I have code to pull the value of the unbound combobox into a bound textbox. This much works. When I change the combobox value the textbox changes approriately. I have a sub form to display all of the related information to the choice on the list. The subform has parent link and child link set to the bound value of the text box. My problem is the sub form does not update to reflect the change. Also, when I try to go to design mode or close the form I get an error message it can't be saved because it would create duplicate index, primary key, etc. Option Compare Database Private Sub cboMovieTitle_AfterUpdate() Me.txtmovieID = Me.cboMovieTitle End Sub since it wasn't updating, I tried this... added to movieID on query [forms]![frmEditMovies]![txtmovieID] code Private Sub txtmovieID_Change() Me.Requery End Sub -- Thanks for your help. Karen53 |
#5
|
|||
|
|||
combobox & Subform
Thank you beetle
-- Thanks for your help. Karen53 "Beetle" wrote: What are you trying to do? If you're trying to find a record on your form based on the value selected in the combo box, then you're going about it the wrong way. You don't want to actually change the value of the bound MovieID text box, you just want to *find* the record with the matching ID. The After Update event of your combo box should have code like this; With Me.RecordsetClone .FindFirst "[MovieID]=" & Me.YourComboBox If Not .NoMatch Then Me.Bookmark = .Bookmark End If End With -- _________ Sean Bailey "Karen53" wrote: Hi, No, I got it to work all on one form but how do I link it to a sub form? -- Thanks for your help. Karen53 "Karen53" wrote: Hi, I'm having trouble with this. I found a previous post and thought I had the answer but am still having trouble. I have an unbound combobox looking up a list. Once a selection is made I have code to pull the value of the unbound combobox into a bound textbox. This much works. When I change the combobox value the textbox changes approriately. I have a sub form to display all of the related information to the choice on the list. The subform has parent link and child link set to the bound value of the text box. My problem is the sub form does not update to reflect the change. Also, when I try to go to design mode or close the form I get an error message it can't be saved because it would create duplicate index, primary key, etc. Option Compare Database Private Sub cboMovieTitle_AfterUpdate() Me.txtmovieID = Me.cboMovieTitle End Sub since it wasn't updating, I tried this... added to movieID on query [forms]![frmEditMovies]![txtmovieID] code Private Sub txtmovieID_Change() Me.Requery End Sub -- Thanks for your help. Karen53 |
Thread Tools | |
Display Modes | |
|
|