Set row source of Listfield in main Form

MarionD

Registered User.
Local time
Today, 11:41
Joined
Oct 10, 2000
Messages
425
Hi all,

I have a list field in my main form, giving an overview of records in a subform. The sub form calls a Public Function in the main form, whereby I set the row source of the list field, to include the record I have just entered in the subform. My problem ist that the moment I set the row source of the list field, the sub form is requeried and goes to the first record. I dont requery the sub form in the code.
I dont want this to happen as I need to continue entering data in the sub form.
The listfield is on a different register. I want to be able to enter data on the subform, save the record, click on the register where the list is - see the new record-then go back to the sub form register and continue entering info into the same record.
The code I'm using is:
sqlBerechtigter = "SELECT tbl_Berechtigter.ID, tbl_Berechtigter.tbl_Grab_ID, [Nachname] & ', ' & [Vorname] AS Berechtigter, " _
& "[Strasse] & ' ' & [Hausnr] & ', ' & [plz] & ' ' & [ort] AS Anschrift, tbl_Berechtigter.Telefon, tbl_Berechtigter.Email, " _
& "tbl_Berechtigter.Berechtigungsbeginn as Beginn, tbl_Berechtigter.Berechtigungsende " _
& "FROM tbl_Berechtigter " _
& "WHERE tbl_Berechtigter.tbl_Grab_ID=" & Me.gsid & " AND tbl_Berechtigter.Nutzung= -1 AND (tbl_Berechtigter.Berechtigungsende Is Null);"
Me.NutzBerechtigter.RowSource = sqlBerechtigter
Me.NutzBerechtigter.Requery

I am using me. as the code is a public function in the main form. I have also tried Forms!Mainform!Listfield.rowsource=sqlBerechtigter, but it still does the same.

I would really appreciate some help!
Thanks
Marion
 

Users who are viewing this thread

Back
Top Bottom