Tracking recordnavigation

  • Thread starter Thread starter Benny
  • Start date Start date
B

Benny

On a form I have a combobox with names en surnames; when I select an item in
this combobox the record showed on the form is updated. Now when I select a
first, previous, next and last record with the recordselectors at the bottom
of the form my comboboxItem is not updated. How can I tracking a
recordnavigation on the recordselectors on the bottom of the form so I can
use something like this :

Private Sub RecordTracking
cboBox.text = Me.MyRecordField.value
End Sub

Thanks in advance

Benny
 
Hi Benny,

Thanks for your post. According to your description, I understand that you
want track record navigation and add some codes under the event of this
navigation bar control.

As for as I know, unfortunately, I am afraid it is hard to look for the
events of the navigation bar and add the underlying VBA codes. However, you
can create your own navigation buttons and add VBA codes for your purposes.

Please use the navigation buttons property of the form to disable the
navigation bar and easily use command button wizard to create your own
navigation buttons.

Please feel free to post in the group if this solves your problem or if you
would like further assistance on this issue.

Thank you,

Michael Shao
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights
 
Benny,

If you were to do this with a macro, you would use a SetValue macro
action. However, your question relates to a vba procedure, so I will
answer in kind. The reason the combobox display is not updated is
because it is unbound. The type of code you have suggested could go on
the On Current event of the form. In this case, MyRecordField refers to
the bound control on the form which should have the same value as the
'bound column' of the unbound cboBox. Something like this...
Private Sub Form_Current()
Me.cboBox = Me.MyRecordField
End Sub

The other approach which would be sometimes used in this type of
situation is to leave the combobox blank. THis ass umes that the
person's name is already displayed in the applicable bound control on
the form, so to have it in the combobox just results in it being shown
twice. Having the combobox blank also helps make it clear that its
purpose is for navigation, not for data functionality. If you do it
this way, you can find the code whatever it is (maybe this is on
cboBox's After Update event) which makes "the record showed on the form
is updated", and at the end of the code add something like this...
me.cboBox = Null
 
Hi Steve,

Thanks for you're solutions, the second one I don't prefere due the layout
of the form. The first one works in an manor fine, but somethimes I get the
error:

Error 2115: Can't save data in this field ... macro or function with
property set Before_Update or a Validation_Rule for this field.

I don't use etherone of these propertys or methods.
Is there not an event that is trigeret when I use de recordselectors (ie:
FormUpdate, FormRepaint,....) where I than can put the code to refresh the
combox.text-attribute ?

Thanks for any solution,

Benny
 
Benny,

Yes, it's the event I have already indicated... the Form_Current event.
By the way, you do not want to use the Text property of the Combobox,
this is not relevant or correct.

I suspect the error you are getting is not related to the code I gave
you. The combobox is unbound, right? What is the code you have on the
combobox that takes you to the selected record? Are you using
DoCmd.FindRecord?
 
Hi Benny,

How is the issue going on your side? Let us know if you need further
assistance on this issue.

Regards,

Michael Shao
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top