Updating from sub form to main form

R

Robin Chapple

I have a clubs database where members move between clubs. I need to
keep a history.

I have a Members table which includes MemberID and DateJoinedLeague.

The MemberHistory table includes MemberID, ClubID, DateJoinedThisClub
and a DateTerminated field. Active members are found where
DateTerminated is null.

Past history is very patchy and not all members show a
DateJoinedLeague field.

I need to populate the DateJoinedLeague field when we edit an existing
member and the field is empty. The sub form will show
DateJoinedThisClub and I need that to be included in the main form.

Equally when a new member is added I need the DateJoinedLeague field
to be copied from the DateJoinedThisClub field which is on the
subform.

I tried this in the sub form which does not work:

Private Sub Form_Current()

If IsNull(Forms!frmMembers![DateJoinedLeague]) Then
Forms!frmMembers![DateJoinedLeague] = [DateJoinedThisClub]
End If

End Sub


Error message:

Runtime error 2448
You can't assign a value to this object.

I am unable to find a specific mention of the subject on Google.
Plenty of 'run time' several '2448' but not together.

Thanks,

Robin
 
V

Van T. Dinh

Have you checked:

* Whether the MainForm's RecordSource is updateable?
* Whether the AllowEdits Property of the MainForm is set to True?
 
V

Van T. Dinh

I think you may need to use the Repaint Method on the Main Form to force the
change to be displayed on the Main Form.
 
V

Van T. Dinh

From Access VB Help:

"The Repaint method completes any pending screen updates for a specified
form. When performed on a form, the Repaint method also completes any
pending recalculations of the form's controls."

See Help for more details.
 
R

Robin Chapple

Please remember that I am "Getting Started" as the newsgroup name
quotes.

I have read the Help but obviously do not understand.

Here is my code from the sub form:

Private Sub Form_Current()

If IsNull(Forms!frmMembers![DateJoinedLeague]) Then
***Forms!frmMembers![DateJoinedLeague] = [DateJoinedThisClub]*****1
End If

DoCmd.RepaintObject

End Sub

I get an error message:

Error 1448
You can't assign a value to this object

at the line marked with asterisks.



Thanks,

Robin Chapple
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top