(Solved) – How do I run an append query in Access VBA to create a certain number of identical records based on a quantity in a field on the form?

(solved)-–-how-do-i-run-an-append-query-in-access-vba-to-create-a-certain-number-of-identical-records-based-on-a-quantity-in-a-field-on-the-form?

first thanks for any help you can provide.

Below is the append query I’m working with – straight forward. On the same form I’m pulling the values referenced from, there is a field that holds a quantity. I want this quantity to be referenced to perform this append query that number of times. If the quantity in the field is 6, then I want the append query to run 6 times. I know this would be a loop, but I’m rusty and I cannot find any clear examples of this on stack or elsewhere on the web.

Thanks again,

Shawn

Code thus far:


Dim strSQL As String

'*****Append record to table*****
strSQL = "INSERT INTO tblStructuresNoDAworking (StructName, State, Brand, Flavor_Sub, _
            Type, Size, Bottles_Case, Entry_Date) VALUES ('" & Me.Text90 & "','" & Me.Text26 _
            & "','" & Me.Text28 & "','" & Me.Text30 & "','" & Me.Text91 & "','" & Me.Text92_
            & "','" & Me.Text93 & "', '" & Now() & "')"

DoCmd.RunSQL (strSQL)

End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *