I have a main form called "New Fixtures"
In this form I have one field called "Fixture"
I also have one subform called "ChoosenParts_subform"
In the subform I have 2 fields called "Part" and "Operation"
What I am trying to achieve is:
I want a form that you enter a specific fixture number. Then I will enter the Part Number(s) and Operation(s) for this fixture in the subform. When I am done I will click on a command button called "cmdSave" this will copy the data I have just entered into my main form and subform and place it as a new record in a table called "Part".
My code is as follows:
Expand|Select|Wrap|Line Numbers
- Private Sub cmdSave_Click()
- Dim strSQL As String
- Dim Fixt As Variant, Part As Variant, Op As Variant
- Fixt = Me.FixtureNumber
- *Part = Forms![New Fixture]![ChoosenParts_subform].Form.["Part"]
- *Op = Forms![New Fixture]![ChoosenParts_subform].Form.["Operation"]
- With Me
- strSQL = "INSERT INTO [FixtPart] " & _
- "([Fixture] " & _
- ",[Part] " & _
- ",[Operation] " & _
- "VALUES ('%F' " & _
- ",'%P' " & _
- ",'%O')"
- strSQL = Replace(strSQL, "%F", Fixt)
- strSQL = Replace(strSQL, "%P", Part)
- strSQL = Replace(strSQL, "%O", Op)
- Call CurrentDb.Execute(strSQL)
- MsgBox "Fixture Information Updated!", vbOKOnly, "...Complete..."
- End With
- End Sub
Any help on this is greatly appreciated.
Regards,
greeni91