Option Compare Database
Option Explicit
Public Sub erya()
Dim pozsayi As Integer
Dim sayi As Integer
Dim olcu As String
Dim i, a As Integer
Dim sorgu As String
Dim sorgusayi As Long
Dim devirsorgu As Recordset
Dim frm As Form
Dim ctllabel, ctlline As Control
''''''''''''''''''''''''''''''''''''''''''''''''her yeni formda eski form silinecek
Set frm = CreateForm ' yeni form olustur
Set devirsorgu = Application.CurrentDb.OpenRecordset("SELECT * FROM tablohareket")
devirsorgu.MoveLast: devirsorgu.MoveFirst
Do
For a = 1 To devirsorgu.RecordCount
For i = 1 To devirsorgu!camsayi
Set ctllabel = CreateControl(frm.Name, acLabel, , , " poz " & devirsorgu!poz & "-" & i)
ctllabel.Name = "poz" & a & "-" & i
With ctllabel
.FontSize = 12
.BorderColor = vbRed
.BorderStyle = 1
If a = 1 Then
.Move (i * 1000 - 800), (80), 1000, 1600
Else
.Move ((i * 1000) - 800), ((a - 1) * 1600 + 80), 1000, 1600
End If
End With
Next
devirsorgu.MoveNext
Next
Loop Until devirsorgu.EOF
Forms(frm.Name).NavigationButtons = False 'gezinti dügmeleri kapalı
Forms(frm.Name).RecordSelectors = False 'kayıt seçici kapalı
Forms(frm.Name).DividingLines = False 'kayıt bölücü kapalı
DoCmd.Close acForm, frm.Name, acSaveYes
' DoCmd.OpenForm frm.Name, acNormal
devirsorgu.Close
Set devirsorgu = Nothing
End Sub
Ayrıca, bu kod 20. kayıttan sonra çalışmaz. Form yüksekliği "31680" twips değerinden (55,873cm) büyük olamaz.