I have a strange little problem with the OnClick() command when using an Image instead of a Command Button.
Originally I had a code working fine from a Cmd button but changed it to an image for aesthetic reasons and now it doesn't work properly.
The set up is:
Continuous form listing customers details (See image attached)
The problem occurs when this next piece of code runs (I think!)
As I click the button I can see the Customer Number in the TxtHiddenCN field change to the correct Customer Number for a split second and then it returns to the customer number that happens to be at the top of the customer list.
As a result the next form that opens uses the Customers details that were at the top of the search results and not customer I selected.
Code:
'Customer Search Form
Private Sub DiaryImage_Click()
Me.TxtHiddenCN.SetFocus
Me.TxtHiddenCN.Text = [Forms]![F_Booking Customer Search].[Customer Number]
DoCmd.OpenForm "Customer Search Query"
End Sub
Oh, there is a Customer number field on each record as well, this is where the TxtHiddenCN is getting its data from . . . the field is visible but text is white and the column width has been reduced significantly so it can't actually be seen. I put the TxtHiddenCN in originally to make sure the code was doing what it was supposed to (i.e. actually see what customer number was being selected) and I never changed it . . . theoretically though the code should work exactly the same using just the original Customer Number field.
Is there something specific that works differently when assigning code to an image as opposed to a cmd button . . . Help :-/
Luke