Guest_imported
New member
- Jan 1, 1970
- 0
Hello everyone,
I have a report in which I have set the "On Open" property like so:
Private Sub Report_Open(Cancel As Integer)
Me.one.ControlSource = 1
End Sub
This lets me dynamically set the control source. In this case, it will set the textbox called "one" to read from the field called "1"
This is all well and good, but I want to use the value of another field to set the control source by, and I want to do it "on the fly". For example, I have a textbox called "howmany". Let's say it's value was 2, I want to be able to use this VBA:
Private Sub Report_Open(Cancel As Integer)
Me.one.ControlSource = me.howmany
End Sub
...and I want that to have the effect of setting the ControlSource of "one" as "2" (thus, reading from a field called 2)
The problem I am having is that, when using the OnOpen property, MS Access tells me that Me.howmany doesn't have a value yet. It only seems to have a value at the OnPage stage.... but by which time, it won't let me set the ControlSource anymore!
Any ideas gratefuly received!
Joseph
I have a report in which I have set the "On Open" property like so:
Private Sub Report_Open(Cancel As Integer)
Me.one.ControlSource = 1
End Sub
This lets me dynamically set the control source. In this case, it will set the textbox called "one" to read from the field called "1"
This is all well and good, but I want to use the value of another field to set the control source by, and I want to do it "on the fly". For example, I have a textbox called "howmany". Let's say it's value was 2, I want to be able to use this VBA:
Private Sub Report_Open(Cancel As Integer)
Me.one.ControlSource = me.howmany
End Sub
...and I want that to have the effect of setting the ControlSource of "one" as "2" (thus, reading from a field called 2)
The problem I am having is that, when using the OnOpen property, MS Access tells me that Me.howmany doesn't have a value yet. It only seems to have a value at the OnPage stage.... but by which time, it won't let me set the ControlSource anymore!
Any ideas gratefuly received!
Joseph