Settin

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an AddComments form that I open from another reviewFeedback form. The
AddComments form is bound to a table of the same name; the table is linked to
the Feedback table via the idFeedback field. I would like to open the
AddComments form and programmatically set the idFeedback control on the
AddComments form to whatever value is showing in the reviewFeedback,
idFeedback control. I tried this code but it doesn't work.

Two questions: (1) Why doesn't it work? (2) How can I do what I am trying to
do?

Private Sub Form_Open(Cancel As Integer)
Me!idFeedbackNumber = Forms!reviewFeedback.idFeedbackNumber
End Sub
 
need a little more info, please:
are you getting an error message? if so, what does it say? or is the code
entering the wrong idFeedbackNumber value? also, are the idFeedbackNumber
fields i nthe two tables linked in the Relationships window? if so, is
referential integrity enforced?
 
Hi Bjnova,

If you're trying open two forms bound to the same table (i.e. or the same
related tables) and you want both forms to be on the same record (in sych)
all the time, then look into the use of Recordsetclone and Bookmark.

Having said that, the wording of your post and how you name your forms
suggest that maybe you just want to have a form/subform of
Feedback/Comments? Something like adding one or more comments for each
Feedback?

I apologize if I've misunderstood.


HTH,
Immanuel Sibero
 
bjnova said:
I have an AddComments form that I open from another reviewFeedback
form. The AddComments form is bound to a table of the same name; the
table is linked to the Feedback table via the idFeedback field. I
would like to open the AddComments form and programmatically set the
idFeedback control on the AddComments form to whatever value is
showing in the reviewFeedback, idFeedback control. I tried this code
but it doesn't work.

Two questions: (1) Why doesn't it work? (2) How can I do what I am
trying to do?

Private Sub Form_Open(Cancel As Integer)
Me!idFeedbackNumber = Forms!reviewFeedback.idFeedbackNumber
End Sub

As Tina pointed out, it really helps in these sorts of questions if you
explain in what way it doesn;t work, and what error message you get (if
any). In this case, one possibility is that the Open event of your
AddComments form is just too soon to be assigning a value to one of its
bound controls. You might try moving your code to the form's Current
event.
 
Back
Top