Open a Form on a Record Problem

Adam McReynolds

Registered User.
Local time
Yesterday, 19:59
Joined
Aug 6, 2012
Messages
129
I need to open a Form based on the text box of another form. The problem is that the Record ID field I need to open the 2nd form on is not able to be altered and is not locked. So the 1st form text box that holds the Record ID is (txt_rid1) Unbound and the 2nd form field is a text box (prikey) that is bound to a table and is named (Key). Here is the code I tried:
Code:
Private Sub btn_parts1_Click()
If Not IsNull(Me.txt_rid1) Then
DoCmd.OpenForm "frm_Module_Repairs_Outbound", acNormal, "prikey = " & Me.txt_rid1 & ""
Else
MsgBox "There is No Record ID to Update or Add Parts to."
End If
End Sub

It won't open on that record ID because the prikey on the 2nd form that I am opening to will not allow itself to be altered.

Any help would be much appreciated!

P.S. I should add that the table the 2nd form has bound text boxes to has prikey as an auto number and primary key. Also if records are deleted then the prikey wont reflect the number of record symmetrically.
 
Last edited:
I think you have it in the wrong position. Try

DoCmd.OpenForm "frm_Module_Repairs_Outbound", acNormal, , "prikey = " & Me.txt_rid1
 
I think you have it in the wrong position. Try

DoCmd.OpenForm "frm_Module_Repairs_Outbound", acNormal, , "prikey = " & Me.txt_rid1

Works Great! Thanks a million.
 
No problem! I also dropped the bit at the end, which was unnecessary (but wasn't the cause of your problem).
 

Users who are viewing this thread

Back
Top Bottom