A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

combobox & Subform



 
 
Thread Tools Display Modes
  #1  
Old May 9th, 2008, 08:11 PM posted to microsoft.public.access.forms
Karen53
external usenet poster
 
Posts: 40
Default 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  
Old May 9th, 2008, 08:33 PM posted to microsoft.public.access.forms
Karen53
external usenet poster
 
Posts: 40
Default 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  
Old May 9th, 2008, 08:41 PM posted to microsoft.public.access.forms
Karen53
external usenet poster
 
Posts: 40
Default 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  
Old May 10th, 2008, 12:32 AM posted to microsoft.public.access.forms
Beetle
external usenet poster
 
Posts: 1,254
Default 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  
Old May 11th, 2008, 10:27 PM posted to microsoft.public.access.forms
Karen53
external usenet poster
 
Posts: 40
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:01 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.