Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
  1. #16
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441

    Code:
    Private Sub cmdgen_Click()
        Dim sealnum As Integer
        Dim strText As String
        Dim techname As String
        Dim TextSequence As String
    
        techname = cbox.column(x)   '<<= this could be a reference to a control on the form X STANDS FOR THE 0 INDEXED VALUE OF THE TECHNICIAN NAME IN YOUR COMBO BOX
    
        For sealnum = Me.box1 To Me.box2  '<-references to controls on the form
            TextSequence =  sealnum & " " & techname 
    
            strText = "INSERT INTO sealinventorytbl (sealnum)  VALUES ('" & TextSequence & "')"
            Debug.Print strText   'for debugging
            CurrentDb.Execute strText
        Next sealnum
    
    End Sub
    if it fails on the currentdb.execute command you need to enable a reference microsoft DAO 3.x will work just fine.

  2. #17
    Alexander is offline Novice
    Windows 8 Access 2007
    Join Date
    Feb 2015
    Posts
    7

    many thanks

    Quote Originally Posted by rpeare View Post
    Code:
    Private Sub cmdgen_Click()
        Dim sealnum As Integer
        Dim strText As String
        Dim techname As String
        Dim TextSequence As String
    
        techname = cbox.column(x)   '<<= this could be a reference to a control on the form X STANDS FOR THE 0 INDEXED VALUE OF THE TECHNICIAN NAME IN YOUR COMBO BOX
    
        For sealnum = Me.box1 To Me.box2  '<-references to controls on the form
            TextSequence =  sealnum & " " & techname 
    
            strText = "INSERT INTO sealinventorytbl (sealnum)  VALUES ('" & TextSequence & "')"
            Debug.Print strText   'for debugging
            CurrentDb.Execute strText
        Next sealnum
    
    End Sub
    if it fails on the currentdb.execute command you need to enable a reference microsoft DAO 3.x will work just fine.

    hey thanks a lot. the code is running good, a little adjustment was made to allow the data to go into the columns sealnum and techname.

    Private Sub cmdgen_Click()
    Dim sealnum As Integer
    Dim strText As String
    Dim techname As String
    Dim TextSequence As String
    techname = cbox.Column(0)
    For sealnum = Me.box1 To Me.box2
    TextSequence = sealnum
    TextSequence1 = techname
    strText = "INSERT INTO sealinventorytbl (sealnum, techname) VALUES ('" & TextSequence & "', '" & TextSequence1 & "')"
    Debug.Print strText 'for debugging
    CurrentDb.Execute strText
    Next sealnum
    End Sub

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 04-21-2014, 02:28 PM
  2. Appointment Generator
    By cheechootrain in forum Access
    Replies: 15
    Last Post: 04-23-2013, 12:37 PM
  3. Replies: 4
    Last Post: 04-09-2013, 03:54 PM
  4. Replies: 2
    Last Post: 06-06-2012, 09:35 AM
  5. Account ID - Generator
    By sschrader1 in forum Queries
    Replies: 4
    Last Post: 04-09-2012, 08:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums