Page 2 of 2 FirstFirst 12
Results 16 to 28 of 28
  1. #16
    SMC's Avatar
    SMC is offline Master Ninja
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Columbus, OH
    Posts
    28
    There is no reason why you need to have the command button in the detail part of the continuous form. Put it in the form header and it becomes a global command and it WILL apply the VBA to all the records.

  2. #17
    adilos is offline Novice
    Windows 7 32bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    14
    i dont know why u didnt understand my be bekoz of my ebglish, i come from germany . so i want to xopy all records form my opned filtered countinous form when is opned . so until i can do that when i click the button, which has the vba-code to that.

    thanx in advance

  3. #18
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    I think that a method to accomplish that has been suggested in previous post.
    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.

  4. #19
    adilos is offline Novice
    Windows 7 32bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    14
    ok tank u vervy much

  5. #20
    adilos is offline Novice
    Windows 7 32bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    14
    thanx chef i will try it tomorow in the oofice

  6. #21
    adilos is offline Novice
    Windows 7 32bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    14
    hello,

    i did r idea. i made Global Button in Header form when i click it, it just worked for the first row

  7. #22
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Perhaps the GoToRecord method will be useful here.
    http://msdn.microsoft.com/en-us/libr...ffice.15).aspx

  8. #23
    adilos is offline Novice
    Windows 7 32bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    14
    hmm is not working. now i hav really Problem. how i can do that. i put the vba code in load form, in the Button in Header form.. but just the first row is copied. my vba code just copy all row from opened form.

    ANY IDEA????
    Last edited by adilos; 08-11-2014 at 11:15 AM.

  9. #24
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616
    Again, there is only ONE button - there is no 'all button'.
    @June , @ItsMe
    I appreciate your patience

  10. #25
    adilos is offline Novice
    Windows 7 32bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    14
    amrut i know what u meant .

    this my VBA-Code when i do it in Global Button i mean the Button in Header Form. it copys just the first row: WHY?

    Private Sub cmdversion_Click()
    Dim db As DAO.Database

    Dim lngRechnungID As Long
    Dim minus As Long
    Dim strSQL As String
    Dim strSQL2 As String
    Dim strSQL3 As String
    Dim up As String

    Set db = CurrentDb

    db.Execute "update dbo_tblVersion_SOLL set Aktive=0 where idv= " & Me!idv & "", dbSeeChanges
    strSQL = "INSERT INTO dbo_tblVersion_SOLL(Projektnummer,Projektname,Proj etkversion,Aktive,fiJahr,fiCreator,kuenstlich) SELECT Projektnummer,Projektname,Projetkversion,Aktive,fi Jahr,fiCreator,0 FROM dbo_tblVersion_SOLL " & "WHERE idv = " & Me!idv
    db.Execute strSQL, dbFailOnError

    If db.RecordsAffected = 1 Then

    lngRechnungID = db.OpenRecordset("SELECT @@IDENTITY").Fields(0)
    minus = lngRechnungID - 1
    strSQL2 = "INSERT INTO dbo_tblKosten_SOLL SELECT " & lngRechnungID & " AS idv, Januar,Februar,Maerz,April,Mai,Juni,Juli,August,Ok tober,September,November,Dezember,fikostenArt,Ip,c ost,anos FROM dbo_tblKosten_SOLL WHERE idv = " & Me!idv

    strSQL = "INSERT INTO dbo_tblKapazitaeten_SOLL SELECT idm, " & lngRechnungID & " AS idv, Januar,Februar,Maerz,April,Mai,Juni,Juli,August,Ok tober,September,November,Dezember FROM dbo_tblKapazitaeten_SOLL WHERE idv = " & Me!idv

    db.Execute strSQL, dbFailOnError
    db.Execute strSQL2, dbFailOnError
    db.Execute "update dbo_tblVersion_SOLL set Projetkversion=Projetkversion+1 where idv= " & lngRechnungID & "", dbSeeChanges
    db.Execute "update dbo_tblVersion_SOLL set Aktive=-1 where idv= " & lngRechnungID & "", dbSeeChanges

    End If

    Me.Requery

    Me.Recordset.FindFirst "idv = " & lngRechnungID

  11. #26
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616
    Experts are already helping you out. What I gather from your code is that the in the first two queries
    "WHERE idv = " & Me!idv
    will select data which matches the above criteria. How many records have similar values of idv ? I think access is picking up the first value of idv as criteria and the queries execute accordingly. I may be completely wrong !

  12. #27
    adilos is offline Novice
    Windows 7 32bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    14
    Really i I appreciate your Help.
    yes @amrut u r right .Access is picking up the first value of idv as criteria, for echt record in countinous form there is a idv. do u hav any idea???

    thanx in advance

  13. #28
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    That code is behind form that has idv field. Since the code references the field on the form, it can only pull value from record that has focus, therefore only records with that value will be affected.

    What is the subform container control Master/Child Links properties set to?

    Options:

    1. VBA opens a recordset object of the desired idv values, loops thru the recordset and uses idv value from each record as criteria in the update action

    2. from post 11: CurrentDb.Execute "INSERT INTO tablename " & Me.RecordSource

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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.

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

Similar Threads

  1. Replies: 6
    Last Post: 11-18-2013, 12:03 PM
  2. Replies: 3
    Last Post: 10-04-2012, 01:33 PM
  3. Replies: 1
    Last Post: 03-31-2012, 01:38 PM
  4. On Click Event For Button On Form
    By Desstro in forum Forms
    Replies: 3
    Last Post: 08-09-2010, 02:36 PM
  5. VB coding for saving when click on save button in form
    By cwwaicw311 in forum Programming
    Replies: 1
    Last Post: 02-04-2010, 11:11 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