H
Howard Brody
tblOrders is the source for your form. On a split, the
data needs to be duplicated into tblSplits. I'd use this
code in the OnClick event of the CommandButton; it pulls
the data from the the various controls on the form, builds
a SQL string with them and then runs the string to append
it to the tblSplits table. You will need to define the
variable data types and controls. You'll also want to the
warnings off before running the query.
Private Sub cmdSplitOrder_Click()
' declare variables
Dim Variable1 as String (or AppropriateDataType)
Dim Variable2 as Long (or AppropriateDataType)
Dim Variable3 as String (or AppropriateDataType)
Dim Variable4 as Date (or AppropriateDataType)
Dim strI as String
Dim strS as String
Dim strSQL as String
Variable1 = [FormControl1]
Variable2 = [FormControl2]
Variable3 = [FormControl3]
Variable4 = [FormControl4]
' build SQL string
strI = "INSERT INTO tblSplits ( Field1, " _
& "Field2, Field3, Field4 ) "
StrS = "SELECT '" & Variable1 & "', " _
& Variable2 & ", '" & Variable3 & "', #" _
& Variable4 & "#;"
StrSQL = strI & strS
' run SQL code and append data
Docmd.RunSQL strSQL
End Sub
Hope this helps!
Howard Brody
data needs to be duplicated into tblSplits. I'd use this
code in the OnClick event of the CommandButton; it pulls
the data from the the various controls on the form, builds
a SQL string with them and then runs the string to append
it to the tblSplits table. You will need to define the
variable data types and controls. You'll also want to the
warnings off before running the query.
Private Sub cmdSplitOrder_Click()
' declare variables
Dim Variable1 as String (or AppropriateDataType)
Dim Variable2 as Long (or AppropriateDataType)
Dim Variable3 as String (or AppropriateDataType)
Dim Variable4 as Date (or AppropriateDataType)
Dim strI as String
Dim strS as String
Dim strSQL as String
Variable1 = [FormControl1]
Variable2 = [FormControl2]
Variable3 = [FormControl3]
Variable4 = [FormControl4]
' build SQL string
strI = "INSERT INTO tblSplits ( Field1, " _
& "Field2, Field3, Field4 ) "
StrS = "SELECT '" & Variable1 & "', " _
& Variable2 & ", '" & Variable3 & "', #" _
& Variable4 & "#;"
StrSQL = strI & strS
' run SQL code and append data
Docmd.RunSQL strSQL
End Sub
Hope this helps!
Howard Brody