Button Control in Multiple Item Form only Interacting with First Record (1 Viewer)

V9kr

New member
Local time
Today, 09:04
Joined
May 15, 2017
Messages
3
After getting lots of help from this forum, I have finally found a problem I couldn't find a solution too by searching for it on Google. Thus this post.

I have a multiple item form with a single button control e.g.:
rec1> [button_1] [ref_num_tb] [data_tb]...
rec2> [button_2] [ref_num_tb] [data_tb]...
rec3> [button_3] [ref_num_tb] [data_tb]...
This button was intended to only interact with the record it is paired with, but lo and behold every button only interacts with the first record, e.g. pressing the button on rec3 (button_3) triggers the query with the data inputs from rec1.
Code:
    sqlCmd = sqlCmd & "SELECT "
    ...
    sqlCmd = sqlCmd & "Contact_Customer_Name "
    sqlCmd = sqlCmd & "FROM tmp_search_" & rndInt
    sqlCmd = sqlCmd & " WHERE tmp_search_" & rndInt & ".Reference_Number = " & Reference_Number_tb.Value

At this juncture,
Code:
Reference_Number_tb.Value
only contains the value of the first record. Is there a way to make the button interact with the record it is listed with?

Thanks for the help!
V9
 

June7

AWF VIP
Local time
Today, 06:04
Joined
Mar 9, 2014
Messages
5,497
Cannot replicate issue. Code works for me. Returns correct value. If you want to provide db for analysis, follow instructions at bottom of my post.
 

Minty

AWF VIP
Local time
Today, 15:04
Joined
Jul 26, 2013
Messages
10,378
Try replacing your reference with
Code:
Me.Reference_Number_tb

Assuming your Control is called the same as the field name.
 

V9kr

New member
Local time
Today, 09:04
Joined
May 15, 2017
Messages
3
Thanks for the replies!

Cannot replicate issue...follow instructions at bottom of my post.
I'll finish commenting the code I have and strip down the tables. Then I'll get it zipped and posted. Thanks for the help.

Try replacing your reference with...Assuming your Control is called the same as the field name.

I did try the
Code:
Me.Reference_Number_tb
but, it didn't work in this case. I sure was excited to try it though. The field names and text box names should be kept almost exactly the same except with the text box names having the
Code:
_tb
at the end of the file name.

Thanks for the help,
V9
 

V9kr

New member
Local time
Today, 09:04
Joined
May 15, 2017
Messages
3
Cannot replicate issue...If you want to provide db for analysis, follow instructions at bottom of my post.

I finished commenting the code and getting so that it would work with the stripped down database. I didn't see the instructions for posting the database, but I would be glad to have it looked at. I can provide a dropbox link if that would work. Please advise if you want me to provide this a different way.


Thanks,
V9kr
 

Users who are viewing this thread

Top Bottom