Form textbox refresh problem

  • Thread starter Thread starter BonnieW via AccessMonster.com
  • Start date Start date
B

BonnieW via AccessMonster.com

Hello!

I have two forms. One is bound to a table of volunteers, the other is bound
to a table of their efforts. The effort form gets data about the volunteers
in a one-to-many fashion (one volunteer, hopefully many efforts). In the
effort table, we have fields for PeopleID, but that's it. In the people
table, we have no identifiers for effort.

I'd like to be able to display the volunteer's first and last name on the
effort form, so that the user can tell what's going on "behind the scenes"
and to prevent entry error. For the first volunteer I choose, there's no
problem with this- it'll display, qiute nicely, PeopleID: 1, Name: John Smith.
However, when I leave the effort form, choose another person, and come back,
the Name field doesn't refresh. I'll get the correct PeopleID, but the old
name, no matter how many people I re-select. I can get down to PeopleID: 53,
and the name will still display as John Smith.

I've checked the code behind the boxes; the Properties are identical between
the two, except for the lack of a Control Source for Name (Name is not
actually the name of the field, no worries there). I've tried setting a
query up as the control source, but no dice. I'd be happy to have a query
set up as the record source, but right now I have first and last name in one
field, concatenated for user ease (we have many people with long first names
and short last names, and vice versa), and I've no idea if I can even do that
with a sql query.

Any sort of suggestions would be very helpful. Thanks in advance.
 
You need to have a people form with a SUBFORM for efforts. The link between
the master and child forms would be PeopleID

HTH
Damon
 
That'd make it too easy. :) If I were developing this from scratch, that's
absolutely what I'd do, but I'm "fixing" an old setup that the users & my
bosses would very much like to keep around.

Perhaps someone might be able to error-check something for me. I'm currently
using this expression for the recordsource of that textbox:
=[Forms]![tablePeople]![Firstname] & " " & [Forms]![tablePeople]![Lastname]
which works great for the first time the form is used, but fails to refresh
on subsequent uses. Is there anything inherently wrong with that code?

Also, when I refresh my Effort form from a command button on the People form,
nothing actually refreshes. This is the code I use, which doesn't give me
any errors, and works apart from the refresh issue.

Private Sub Command28_Click()
'the "record the valiant effort of this volunteer" button

On Error GoTo Err_Command28_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmVolEffortGen"

'check to see that a name is actually selected
If IsNull(Me!LastName) Then
MsgBox "Choose a volunteer, or create a new one."
Cancel = True
Me!Combo26.SetFocus
'if frmVolEffortGen is loaded
ElseIf CurrentProject.AllForms("frmVolEffortGen").IsLoaded Then
'go to the form...
Forms![frmVolEffortGen].SetFocus
DoCmd.GoToRecord , frmVolEffortGen, acNewRec
'DoCmd.GoToRecord , , acNewRec
'update the control with names
Forms![frmVolEffortGen].Requery
Forms![frmVolEffortGen]![VolName].Requery
Else
'open the form (@newrecord), set focus to a control
DoCmd.OpenForm "frmVolEffortGen"
DoCmd.GoToRecord , , acNewRec
End If


Exit_Command28_Click:
Exit Sub

Err_Command28_Click:
MsgBox Err.Description
Resume Exit_Command28_Click

End Sub

Is there something wrong with that, somewhere? It looks fine to me, but one
reading of Access VBA for Dummies does not an expert make, unfortunately.

Damon said:
You need to have a people form with a SUBFORM for efforts. The link between
the master and child forms would be PeopleID

HTH
Damon
[quoted text clipped - 33 lines]
Any sort of suggestions would be very helpful. Thanks in advance.
 
Back
Top