Hi!
I am trying to look up a part number using a text box. If this part number is found, I would like to make a revision change (I would like to keep the old information). If it is not found, I would like to enter a new record.
So, now I have this set up to pull up the record, but it will write over the old information. I think this is due to the fact that I am "Finding Next". I would like to have the part number looked up, find the Unique identifier associated to it (this will fill in the subforms with the same unique identifier) and I can then change the revision. I have entered the code below:
Dim strPartID As String
strPartID = Me!PartID
DoCmd.GoToRecord , , acNewRec
Me!PartID = strPartID
I hope this makes sense. I added the Go to New record thing (in red), while trying to use the PartID and when it ran it said that I cannot do this. I thought it might be a solution, but I just ended up with more problems. I do not know Visual Basic at all, I have self-adapted my code that I have.
Thank you in advance for any help that can be achieved.
Wally
I am trying to look up a part number using a text box. If this part number is found, I would like to make a revision change (I would like to keep the old information). If it is not found, I would like to enter a new record.
So, now I have this set up to pull up the record, but it will write over the old information. I think this is due to the fact that I am "Finding Next". I would like to have the part number looked up, find the Unique identifier associated to it (this will fill in the subforms with the same unique identifier) and I can then change the revision. I have entered the code below:
Code:
Private Sub Text76_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset
rs.FindFirst "[PartNumber] = """ & [Text76] & """"
strPartID = Me!PartID
DoCmd.GoToRecord , , acNewRec
Me!PartID = strPartID
Code:
DoCmd.GoToControl "Revision"
Me.Revision.Locked = False
Me.ECN.Locked = False
If rs.NoMatch Then
DoCmd.GoToRecord , , acNewRec
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
End If
End Sub
I hope this makes sense. I added the Go to New record thing (in red), while trying to use the PartID and when it ran it said that I cannot do this. I thought it might be a solution, but I just ended up with more problems. I do not know Visual Basic at all, I have self-adapted my code that I have.
Thank you in advance for any help that can be achieved.
Wally