Bill Software Engineer
Bill Software Engineer

Reputation: 7782

Replacing Text In a Textbox in Continues Forum

It's simple enough to change the textbox value of a form. But how do I change the text box of a Continues Forum on every record?

The onLoad Event does not work because it just change for the first record only. Any ideas?

Example Code:

Private Sub Form_Load()
    txb_name.Value = txb_name.Value & "Test"
End Sub

In this example, the Continues Form would look like this:

 Text1Test
 Text2
 Text3
 Text4
 Text5
 Text6

Notice how it only changed the first record.

What I would need is this:

 Text1Test
 Text2Test
 Text3Test
 Text4Test
 Text5Test
 Text6Test

Upvotes: 0

Views: 57

Answers (2)

Bill Software Engineer
Bill Software Engineer

Reputation: 7782

Found the solution using calling my own function in RecordSource:

=myFunction(fieldName)

And then, you can just put whatever you want in the function

Function myFunction(fieldNameAs String)
    myFunction= fieldName& "Test"
End Function

This will loop over all records instead of just the first one.

Upvotes: 1

Luke Wage
Luke Wage

Reputation: 703

Why not update the underlying data source via SQL?

Option Compare Database
Option Explicit

Private Sub Form_Load()
    DoCmd.RunSQL "UPDATE myTable SET myField = myField + 'Test'"
End Sub

Upvotes: 0

Related Questions