Hi.
This was working, I thought. Then I changed some stuff. I thought that I put it back to normal, and it doesn't work. This is what I am hoping to do:
I want a user to type in a PartNumber in an unbound text box called Text76. I want the database to either find the part number and display it, or I want to add that as a new record. This is my code:
When the user types in a value, if it is found, the focus is placed on the "revision" control, but as a new record (no information is displayed). If it is not found, then I get an error that says I can't go to specified control "Family".
Any suggestions? Any help will be greatly appreciated. Also is there anyway to save VBA code, so I can change stuff and go back to the original if I need to?
Thanks again.
Wally
This was working, I thought. Then I changed some stuff. I thought that I put it back to normal, and it doesn't work. This is what I am hoping to do:
I want a user to type in a PartNumber in an unbound text box called Text76. I want the database to either find the part number and display it, or I want to add that as a new record. This is my code:
Code:
Private Sub Text76_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset
rs.FindFirst "[PartNumber] = """ & [Text76] & """"
DoCmd.GoToControl "Revision"
Me.Revision.Locked = False
Me.ECN.Locked = False
If rs.NoMatch Then
strText76 = Me!Text76
strPartNumber = Me!PartNumber
Me!PartNumber = strText76
DoCmd.GoToControl "Family"
Me.Family.Locked = False
Me.MultiplePages.Locked = False
Me.DrawingSizeSheet1.Locked = False
Me.DrawingSizeSheet2.Locked = False
Me.DrawingSizeSheet3.Locked = False
Me.Description.Locked = False
Me.Revision.Locked = False
Me.ECN.Locked = False
Me.FirstUsedOn.Locked = False
DoCmd.GoToControl "Family"
End If
End Sub
When the user types in a value, if it is found, the focus is placed on the "revision" control, but as a new record (no information is displayed). If it is not found, then I get an error that says I can't go to specified control "Family".
Any suggestions? Any help will be greatly appreciated. Also is there anyway to save VBA code, so I can change stuff and go back to the original if I need to?
Thanks again.
Wally