|
|
"Microsoft Office Access can't find the field 'cboMovieLookup' referred to in you expression."
I have a subform that I am attempting to add a combo box that lists the movie ID and when the user clicks on the movie ID it will fill in info like the Movie Title in a text box. I've doen this on the main form using similar code and it worked fine, but it is not working now and getting the Run tim error 2465. I have a feeling it has to do with naming conventions but not sure.
Private Sub cboMovieLookup_AfterUpdate()
Me.VideoTitle = DLookup("[VideoTitle]", "tblVideos", "[VideoID]=[Forms]![Rent Movie].[cboMovieLookup]")
End Sub
So the way I understand this code is in that it looks up the Video Title from the form Rent Movie where VideoID matches the selection made in the cboMovieLookup combo box.
Any help would be appreciated.
|
|
On Thu, 4 Dec 2008 18:07:00 -0800, jtbleek <jtbleek[ at ]discussions.microsoft.com> wrote:
I'm guessing all the control names you mentioned are in your subform, and [Rent Movie] is the name of your subform. If so, it don't work that way, because the syntax to access a subform control is more complicated than that: Forms!YourMainForm!YourSubformControlName.Form!YourControlNameOnSubform
But fortunately this works as well in your case (if my assumption is true): Me.VideoTitle = DLookup("VideoTitle", "tblVideos", "VideoID=" & Me.cboMovieLookup)
-Tom. Microsoft Access MVP
[Quoted Text] >"Microsoft Office Access can't find the field 'cboMovieLookup' referred to in >you expression." > >I have a subform that I am attempting to add a combo box that lists the >movie ID and when the user clicks on the movie ID it will fill in info like >the Movie Title in a text box. I've doen this on the main form using similar >code and it worked fine, but it is not working now and getting the Run tim >error 2465. I have a feeling it has to do with naming conventions but not >sure. > >Private Sub cboMovieLookup_AfterUpdate() > >Me.VideoTitle = DLookup("[VideoTitle]", "tblVideos", >"[VideoID]=[Forms]![Rent Movie].[cboMovieLookup]") > >End Sub > >So the way I understand this code is in that it looks up the Video Title >from the form Rent Movie where VideoID matches the selection made in the >cboMovieLookup combo box. > >Any help would be appreciated. >
|
|
That works great, but I've run into one other problem. I want the form to be able to show more then one movie but I use the combo box to enter in the movie info, but then when I add another record it uses the same value in the combo box on the line above. If I change it it changes the information on the first movie. Is there a way for each record in the subform to be unique? Sorry if it confusing.
"Tom van Stiphout" wrote:
[Quoted Text] > On Thu, 4 Dec 2008 18:07:00 -0800, jtbleek > <jtbleek[ at ]discussions.microsoft.com> wrote: > > I'm guessing all the control names you mentioned are in your subform, > and [Rent Movie] is the name of your subform. > If so, it don't work that way, because the syntax to access a subform > control is more complicated than that: > Forms!YourMainForm!YourSubformControlName.Form!YourControlNameOnSubform > > But fortunately this works as well in your case (if my assumption is > true): > Me.VideoTitle = DLookup("VideoTitle", "tblVideos", > "VideoID=" & Me.cboMovieLookup) > > -Tom. > Microsoft Access MVP > > > >"Microsoft Office Access can't find the field 'cboMovieLookup' referred to in > >you expression." > > > >I have a subform that I am attempting to add a combo box that lists the > >movie ID and when the user clicks on the movie ID it will fill in info like > >the Movie Title in a text box. I've doen this on the main form using similar > >code and it worked fine, but it is not working now and getting the Run tim > >error 2465. I have a feeling it has to do with naming conventions but not > >sure. > > > >Private Sub cboMovieLookup_AfterUpdate() > > > >Me.VideoTitle = DLookup("[VideoTitle]", "tblVideos", > >"[VideoID]=[Forms]![Rent Movie].[cboMovieLookup]") > > > >End Sub > > > >So the way I understand this code is in that it looks up the Video Title > >from the form Rent Movie where VideoID matches the selection made in the > >cboMovieLookup combo box. > > > >Any help would be appreciated. > > >
|
|
On Thu, 4 Dec 2008 18:49:00 -0800, jtbleek <jtbleek[ at ]discussions.microsoft.com> wrote:
I think I know what you mean. This happens in a subform if the control is not bound (to a table, query). Bind it, to a temp table if you must, and you shall be victorious.
-Tom. Microsoft Access MVP
[Quoted Text] >That works great, but I've run into one other problem. I want the form to be >able to show more then one movie but I use the combo box to enter in the >movie info, but then when I add another record it uses the same value in the >combo box on the line above. If I change it it changes the information on the >first movie. Is there a way for each record in the subform to be unique? >Sorry if it confusing. > >"Tom van Stiphout" wrote: > >> On Thu, 4 Dec 2008 18:07:00 -0800, jtbleek >> <jtbleek[ at ]discussions.microsoft.com> wrote: >> >> I'm guessing all the control names you mentioned are in your subform, >> and [Rent Movie] is the name of your subform. >> If so, it don't work that way, because the syntax to access a subform >> control is more complicated than that: >> Forms!YourMainForm!YourSubformControlName.Form!YourControlNameOnSubform >> >> But fortunately this works as well in your case (if my assumption is >> true): >> Me.VideoTitle = DLookup("VideoTitle", "tblVideos", >> "VideoID=" & Me.cboMovieLookup) >> >> -Tom. >> Microsoft Access MVP >> >> >> >"Microsoft Office Access can't find the field 'cboMovieLookup' referred to in >> >you expression." >> > >> >I have a subform that I am attempting to add a combo box that lists the >> >movie ID and when the user clicks on the movie ID it will fill in info like >> >the Movie Title in a text box. I've doen this on the main form using similar >> >code and it worked fine, but it is not working now and getting the Run tim >> >error 2465. I have a feeling it has to do with naming conventions but not >> >sure. >> > >> >Private Sub cboMovieLookup_AfterUpdate() >> > >> >Me.VideoTitle = DLookup("[VideoTitle]", "tblVideos", >> >"[VideoID]=[Forms]![Rent Movie].[cboMovieLookup]") >> > >> >End Sub >> > >> >So the way I understand this code is in that it looks up the Video Title >> >from the form Rent Movie where VideoID matches the selection made in the >> >cboMovieLookup combo box. >> > >> >Any help would be appreciated. >> > >>
|
|
Pardon my ignorance, but I am not sure what you mean. Isn't the combo box already to my primary key? How would I do what you are saying?
"Tom van Stiphout" wrote:
[Quoted Text] > On Thu, 4 Dec 2008 18:49:00 -0800, jtbleek > <jtbleek[ at ]discussions.microsoft.com> wrote: > > I think I know what you mean. This happens in a subform if the control > is not bound (to a table, query). Bind it, to a temp table if you > must, and you shall be victorious. > > -Tom. > Microsoft Access MVP > > > >That works great, but I've run into one other problem. I want the form to be > >able to show more then one movie but I use the combo box to enter in the > >movie info, but then when I add another record it uses the same value in the > >combo box on the line above. If I change it it changes the information on the > >first movie. Is there a way for each record in the subform to be unique? > >Sorry if it confusing. > > > >"Tom van Stiphout" wrote: > > > >> On Thu, 4 Dec 2008 18:07:00 -0800, jtbleek > >> <jtbleek[ at ]discussions.microsoft.com> wrote: > >> > >> I'm guessing all the control names you mentioned are in your subform, > >> and [Rent Movie] is the name of your subform. > >> If so, it don't work that way, because the syntax to access a subform > >> control is more complicated than that: > >> Forms!YourMainForm!YourSubformControlName.Form!YourControlNameOnSubform > >> > >> But fortunately this works as well in your case (if my assumption is > >> true): > >> Me.VideoTitle = DLookup("VideoTitle", "tblVideos", > >> "VideoID=" & Me.cboMovieLookup) > >> > >> -Tom. > >> Microsoft Access MVP > >> > >> > >> >"Microsoft Office Access can't find the field 'cboMovieLookup' referred to in > >> >you expression." > >> > > >> >I have a subform that I am attempting to add a combo box that lists the > >> >movie ID and when the user clicks on the movie ID it will fill in info like > >> >the Movie Title in a text box. I've doen this on the main form using similar > >> >code and it worked fine, but it is not working now and getting the Run tim > >> >error 2465. I have a feeling it has to do with naming conventions but not > >> >sure. > >> > > >> >Private Sub cboMovieLookup_AfterUpdate() > >> > > >> >Me.VideoTitle = DLookup("[VideoTitle]", "tblVideos", > >> >"[VideoID]=[Forms]![Rent Movie].[cboMovieLookup]") > >> > > >> >End Sub > >> > > >> >So the way I understand this code is in that it looks up the Video Title > >> >from the form Rent Movie where VideoID matches the selection made in the > >> >cboMovieLookup combo box. > >> > > >> >Any help would be appreciated. > >> > > >> >
|
|
On Thu, 4 Dec 2008 23:59:00 -0800, jtbleek <jtbleek[ at ]discussions.microsoft.com> wrote:
Your combobox has a rowsource, but it must also have a ControlSource. -Tom.
[Quoted Text] >Pardon my ignorance, but I am not sure what you mean. Isn't the combo box >already to my primary key? How would I do what you are saying? > > >"Tom van Stiphout" wrote: > >> On Thu, 4 Dec 2008 18:49:00 -0800, jtbleek >> <jtbleek[ at ]discussions.microsoft.com> wrote: >> >> I think I know what you mean. This happens in a subform if the control >> is not bound (to a table, query). Bind it, to a temp table if you >> must, and you shall be victorious. >> >> -Tom. >> Microsoft Access MVP >> >> >> >That works great, but I've run into one other problem. I want the form to be >> >able to show more then one movie but I use the combo box to enter in the >> >movie info, but then when I add another record it uses the same value in the >> >combo box on the line above. If I change it it changes the information on the >> >first movie. Is there a way for each record in the subform to be unique? >> >Sorry if it confusing. >> > >> >"Tom van Stiphout" wrote: >> > >> >> On Thu, 4 Dec 2008 18:07:00 -0800, jtbleek >> >> <jtbleek[ at ]discussions.microsoft.com> wrote: >> >> >> >> I'm guessing all the control names you mentioned are in your subform, >> >> and [Rent Movie] is the name of your subform. >> >> If so, it don't work that way, because the syntax to access a subform >> >> control is more complicated than that: >> >> Forms!YourMainForm!YourSubformControlName.Form!YourControlNameOnSubform >> >> >> >> But fortunately this works as well in your case (if my assumption is >> >> true): >> >> Me.VideoTitle = DLookup("VideoTitle", "tblVideos", >> >> "VideoID=" & Me.cboMovieLookup) >> >> >> >> -Tom. >> >> Microsoft Access MVP >> >> >> >> >> >> >"Microsoft Office Access can't find the field 'cboMovieLookup' referred to in >> >> >you expression." >> >> > >> >> >I have a subform that I am attempting to add a combo box that lists the >> >> >movie ID and when the user clicks on the movie ID it will fill in info like >> >> >the Movie Title in a text box. I've doen this on the main form using similar >> >> >code and it worked fine, but it is not working now and getting the Run tim >> >> >error 2465. I have a feeling it has to do with naming conventions but not >> >> >sure. >> >> > >> >> >Private Sub cboMovieLookup_AfterUpdate() >> >> > >> >> >Me.VideoTitle = DLookup("[VideoTitle]", "tblVideos", >> >> >"[VideoID]=[Forms]![Rent Movie].[cboMovieLookup]") >> >> > >> >> >End Sub >> >> > >> >> >So the way I understand this code is in that it looks up the Video Title >> >> >from the form Rent Movie where VideoID matches the selection made in the >> >> >cboMovieLookup combo box. >> >> > >> >> >Any help would be appreciated. >> >> > >> >> >>
|
|
|