Set Value Action

  • Thread starter Thread starter Krzysztof via AccessMonster.com
  • Start date Start date
K

Krzysztof via AccessMonster.com

Good Day!

I have a form that has an unbound text box, and when the form opens, it is
set to a formula. here is my problem:

my code

Private Function fncName()

Forms!frm_Main!textbox = Formula
Forms!frm_Main!textbox2 = Formula
...

End Function

sub Form_Open()

fncName

End Sub

This works fine for the first line in the function, but if i add another box
( i need 120 of them), it gives me a message box stating 'You have canceled
the previous operation', and no other boxes get filled in, just the first one.
Has anyone seen something like this? do i need to add some kind of seperator
to let it know there is another line?

TIA

~K
 
Krzysztof said:
Good Day!

I have a form that has an unbound text box, and when the form opens, it is
set to a formula. here is my problem:

my code

Private Function fncName()

Forms!frm_Main!textbox = Formula
Forms!frm_Main!textbox2 = Formula
...

End Function

sub Form_Open()

fncName

End Sub

This works fine for the first line in the function, but if i add another box
( i need 120 of them), it gives me a message box stating 'You have canceled
the previous operation', and no other boxes get filled in, just the first one.
Has anyone seen something like this? do i need to add some kind of seperator
to let it know there is another line?

TIA

~K

Rather than using the full reference to the form object, just refer to
the control name. I'm not sure if you're running multiple form
instances, etc. which may cause some problems.

Textbox is also a reserved word, so try renaming your textboxes.
Again, I don't know if this is actual code or pseudo code.

What is the value of Formula? Where are you setting it? Are you setting
the same value equal to all 120 textboxes?

Lastly, your fncName shouldn't be a function if it isn't returning a
value, it should be a sub.

The design seems a little strange, especially with 120 boxes getting the
same value, all unbound.

Maybe you can explain what you're trying to accomplish, rather than the
method you are using to accomplish it.

Dim strFormula as String

Private Sub SetupForm()
txtMyFirstTextbox = "Some Formula Here"
txtMySecondTextbox = strFormula

End Sub

Sub Form_Open()
strFormula = "Another Formula"
SetupForm
End Sub
 
Thanks for your reply,

basically, i am tracking info by week, and what i am doing is turning a
spreadsheet into a database. (i know, i know, bad idea). I have sucessfully
done this over a year, but i would like to make it faster. Yes, i was just
using psuedo code. the formulas i am using Dlookup functions.

Duncan said:
Good Day!
[quoted text clipped - 26 lines]

Rather than using the full reference to the form object, just refer to
the control name. I'm not sure if you're running multiple form
instances, etc. which may cause some problems.

Textbox is also a reserved word, so try renaming your textboxes.
Again, I don't know if this is actual code or pseudo code.

What is the value of Formula? Where are you setting it? Are you setting
the same value equal to all 120 textboxes?

Lastly, your fncName shouldn't be a function if it isn't returning a
value, it should be a sub.

The design seems a little strange, especially with 120 boxes getting the
same value, all unbound.

Maybe you can explain what you're trying to accomplish, rather than the
method you are using to accomplish it.

Dim strFormula as String

Private Sub SetupForm()
txtMyFirstTextbox = "Some Formula Here"
txtMySecondTextbox = strFormula

End Sub

Sub Form_Open()
strFormula = "Another Formula"
SetupForm
End Sub
 
Back
Top