Results 1 to 10 of 10
  1. #1
    accesslover is offline Novice
    Windows 11 Access 2021
    Join Date
    Jan 2023
    Posts
    9

    access continuous form in vba

    hello


    my todays question is
    how i can make continuous form with vba only ?
    also

    how i can add multi records in this continuous form.accdb and save them at the end?

    Attachment 49594Attachment 49594Attachment 49594

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    One way is with an UNBOUND form, lots of UNBOUND controls, and lots of code.

    Another is input to a temp table and then 'move' records to permanent table.

    Another is input to permanent table and then delete records if decide not to retain.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    You don’t need via, just set the form property.

  4. #4
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,400
    another way is to bind the form to an ado disconnected recordset rather than a temp table

  5. #5
    accesslover is offline Novice
    Windows 11 Access 2021
    Join Date
    Jan 2023
    Posts
    9
    Quote Originally Posted by CJ_London View Post
    another way is to bind the form to an ado disconnected recordset rather than a temp table
    could you give me an example using the file I attached??

  6. #6
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,400
    I'll give you an example - it is for you to do the work. Code something like this would be for a form for new entries and be placed in the form load event

    Code:
    dim rs as object
    
            Set rs = CreateObject("ADODB.Recordset")
            With rs
                
                .Fields.Append "firstfieldname", 11 '11=boolean
                .Fields.Append "secondfieldname", 201, 255 '201 =memo/long text - second value is max number of characters
                .Fields.Append "thirdfieldname", 200, 255 ' 200 =advarchar (string) - second value is max number of characters allowed
                etc
    
    
                .CursorLocation = 3 'adUseClient
                .LockType = 3 'adLockOptimistic
                .CursorType = 3 'adOpenStatic
                
                
                Set Me.Recordset = rs
          end with
          
          Me.Recordset.MoveFirst
    here is a link to the different field types
    https://www.devguru.com/content/tech...ield-type.html


    you then need code on your save button to save the entries to a table - I presume you already have something so code might be something like

    Code:
    with me.recordset
    
    .movefirst
    
    while not .eof
        'save the record to a table/exel/whatever
        .movenext
    wend

  7. #7
    xps35's Avatar
    xps35 is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jun 2022
    Location
    Schiedam, NL
    Posts
    229
    Quote Originally Posted by accesslover View Post
    how i can add multi records in this [table] and save them at the end?
    Why not use a bound form? Same effect, much easier, no vba needed.
    Groeten,

    Peter

  8. #8
    accesslover is offline Novice
    Windows 11 Access 2021
    Join Date
    Jan 2023
    Posts
    9
    because I don't want to save records by mistake
    vba give me the ability to control this

  9. #9
    accesslover is offline Novice
    Windows 11 Access 2021
    Join Date
    Jan 2023
    Posts
    9
    Quote Originally Posted by xps35 View Post
    Why not use a bound form? Same effect, much easier, no vba needed.
    because I don't want to save records by mistake
    vba give me the ability to control this

  10. #10
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    You can use a forms before update event to control that and save a world of pain trying to deal with code an unbound form.
    Have a look here
    https://www.access-programmers.co.uk...-and-2.324342/
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 01-13-2022, 02:14 AM
  2. Replies: 1
    Last Post: 03-08-2018, 05:41 AM
  3. Replies: 2
    Last Post: 11-09-2016, 05:54 PM
  4. Replies: 18
    Last Post: 04-11-2016, 03:23 PM
  5. Replies: 2
    Last Post: 01-01-2014, 02:10 PM

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