form and subform synchronising

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Access Training and help » Form and Subform synchronising Q for Anthony | Access forum

Form and Subform synchronising Q for Anthony | Access forum

resolvedResolved · High Priority · Version 2007

Timothy has attended:
Access Advanced course

Form and Subform synchronising Q for Anthony

Hi Anthony.
Have another one for you. I have a form of a table. The fields are shown on the form and below is a scrollable view of the table. Using the record navigation keys allows you to scroll through the table and the selected record is shown in the main form. The same can be achieved by clicking on a record in the scrollable view at the bottom.

Where I come undone is that I have a check box, this is a field in the main table. The idea is that when this check box is true then an append query will run, search for the checked record and append it to another table. The check box is made visible=false and a control button is used to make the check box=true. And after to open a form to allow editing of the appended-to table.

I have used the following code:
Private Sub Command50_Click()
CheckBoxName = True
If CheckBoxName = True Then
DoCmd.OpenQuery "QryName", acViewNormal, acEdit
DoCmd.Close acQuery, "QryName"
End If
DoCmd.OpenForm "FrmName", acNormal
End Sub

I have been using multiple combo boxes to select records in the main form, and they have been working. Using code again:
Combo33 = FieldName
Combo34 = FieldName etc.

Whenever I hit the control button to append to the table the query will run, the form will open but the wrong record is shown in the table.

It seems to me that just because a record is viewed on the main form, it is still possible the form still thinks that another record is actively/currently selected.

Any thoughts on solving this one?

RE: Form and Subform synchronising Q for Anthony

Hi Timothy, that's tricky one to advise you on from afar I'm afraid. However, you might want to double check how you are referring to your subform in your code, that can often cause problems.

http://access.mvps.org/access/forms/frm0031.htm

Hope this helps,

Anthony

RE: Form and Subform synchronising Q for Anthony

Hi Anthony,
Thanks for that, didn't quite solve the issue though the reference sheet was helpful anyway. It seems that the order of procedures had not gone how I intended. So that the table had not updated after input in the form, before the query is run off of it. I just made the form save between these and it seems to work.
On a side note, I did attempt to use Me.OnDirty=false to force the form to save but it kept on asking for a variable.
Cheers
Tim


 

Access tip:

Remove spaces in a table

If you have a table that has too many space marks littered around, you can create a update query and use the trim function to get rid of any excess space marks

View all Access hints and tips


Server loaded in 0.09 secs.