N
nickp
Guest
hi, after a lot of trial and error, i hope someone can help.
I´ve got lots of similar forms which can use the same sub to fill out various controls. Calling a public sub from within the form is ok but how do if refer to the calling form in the sub.
I thought i could use the Me.controls as the form is open, but i just get errors
here´s my code:
Public Sub Fill_names_in_form(inthousenumber As Integer, strformname)
Dim db As Database
Dim counting As Integer
Set db = CurrentDb()
Set rst = db.OpenRecordset("Select * from Abfhausplan Where House like " & " '" & inthousenumber & "'")
rst.MoveLast
rst.MoveFirst
For counting = 1 To rst.RecordCount
forms!(?????????).Controls("occ" & counting) = rst!Vorname & " " & rst!Name
If rst.Klasse <> "" Then strformname.Controls("class" & counting) = "Klasse " & rst!Klasse
rst.MoveNext
Next
???
I´ve got lots of similar forms which can use the same sub to fill out various controls. Calling a public sub from within the form is ok but how do if refer to the calling form in the sub.
I thought i could use the Me.controls as the form is open, but i just get errors
here´s my code:
Public Sub Fill_names_in_form(inthousenumber As Integer, strformname)
Dim db As Database
Dim counting As Integer
Set db = CurrentDb()
Set rst = db.OpenRecordset("Select * from Abfhausplan Where House like " & " '" & inthousenumber & "'")
rst.MoveLast
rst.MoveFirst
For counting = 1 To rst.RecordCount
forms!(?????????).Controls("occ" & counting) = rst!Vorname & " " & rst!Name
If rst.Klasse <> "" Then strformname.Controls("class" & counting) = "Klasse " & rst!Klasse
rst.MoveNext
Next
???