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.
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.
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
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.
ok tank u vervy much
thanx chefi will try it tomorow in the oofice
![]()
hello,
i did r idea. i made Global Button in Header form when i click it, it just worked for the first row![]()
Perhaps the GoToRecord method will be useful here.
http://msdn.microsoft.com/en-us/libr...ffice.15).aspx
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.
@June , @ItsMeAgain, there is only ONE button - there is no 'all button'.
I appreciate your patience![]()
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
Experts are already helping you out. What I gather from your code is that the in the first two queries
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 !"WHERE idv = " & Me!idv
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![]()
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.