Just a quicky...

lynsey2

Registered User.
Local time
Today, 11:03
Joined
Jun 18, 2002
Messages
439
OK guy's I have a text box on my form for the number of days a script has to be for. (Well 7 text boxes for 7 different drugs, each drug needs to be able to be for different amount of days if the Doc wants)

All I need to do is Fill this out automatically from the start and stop date and if the doc wants he/she can change it.

In the control source of Text box 1 I have

=IIf(IsNull([Strength1])=False,[Forms]![ARTScript]![Stop Date]-[Forms]![ARTScript]![Start Date],"")

This fills out the field with what I need to start with but does not allow change.

How can I get it to fill out the field but allow me to overwrite it with what I want??

do i need to do some kinda code in the On Got Focus event???
 
Ok, if I understand it correctly, you first enter a drug in a field and then you want the text box to calculate depending on what you´ve put in the first field, right?

If so, I would put code (with your iif statement) as an after update event of the first field.

Fuga.
 
Em! Nope!
I have a set of 4 combo boxes n one row(Drug form freq strength)
I have 7 rows
At the end of each row I have a text box
This text box fills out with the number of days (which it gets from the start and stop date of the script)
That’s fine.
I now want to be able to highlight the value in the text box and type a different number.

That’s pretty much it.
cheers for your responce!and sorry i wasnt so clear first time :D
 
Hi there,

I think you will have to use code. Presumably you don't need to store the entries in your text boxes as they would be bound to your underlying tables etc.

Have you tried removing the Iif function from the control source of your text box, making it unbound, then set the value of it by placing the the Iif function in after update of the relevant combo box i.e.

Text1.Value = IIf(IsNull([Strength1])=False,[Forms]![ARTScript]
![Stop Date]-[Forms]![ARTScript]![Start Date],"")

Or...

Am I totally barking up the wrong tree :confused:

Probably the latter :p

HTH
Rob
 
I don’t need to store them no! I just need them to print out.
I have it at the moment so that if the doc selects the start and stop date say 01/03/03 and 03/03/03 that’s 2 days so in the report to print this I fill out the day’s field for every drug prescribed with a 2.

I have been asked to have it so that the doc can change this so that if they want to prescribe 2 drugs one for the 2 days and one only for 1 day (Because the patient may have some left from the last time) they can but still have the start and stop dates 01/03/03 and 03/03/03.

SO

I created text boxes next to each row I have for the drugs (I have 7 rows)in the form.
I put the code to fill out the text box with the number of days depending on the start and stop date (our example 2) so for every drug prescribed the Days field is filled in with 2 and prints 2.
THAT’S GREAT!! What I want is if the doc wants to change that 2 to a 1 they can!!!

Does that make it any better??? Sorry!

I suppose all I want to do is fill out a text box with a value automatically (which i can just now) BUT be able to change the value if I want to.
 
Can you post a .jpg to allow us to better visualise this; I know I'm having problems? :confused:
 
Also, wouldn't the number of days between 01/03/03 and 03/03/03 be 3, or do you not count the first day?
 
Ok I think I underdstand what your trying to do so here's my suggestion:

Make your text boxes for the number of days unbound controls then in the AfterUpdate event of [Stop Date] combo box try the code below

If IsNull([Start Date]) = False Then
Text1.Value = IIf(IsNull([Strength1])=False,[Forms]![ARTScript]
![Stop Date]-[Forms]![ARTScript]![Start Date],"")
Else
' Place MsgBox here for Start Date etc...
End If

What I'm trying to get at is that once the Stop Date has been set the value of text1 should be set as you've got it now with the exception that Text1 remains unbound as you've only assigned a value to it which can be overwritten. Obviously you'll need to repeat this code 7 times for each of your rows assuming that your combo boxes and text boxes are named differently.

Hopefully that'll work but may be Mile-O might come up with a better suggestion

HTH
Rob
 
Robert Dunstan said:
but maybe Mile-O might come up with a better suggestion

I doubt it. I've seen the database and the odds of me understanding what is going on are greater than Elvis flying into perform a concert for the Loch Ness Monster on a UFO! About, er, infinity to one.

:p
 
Lyns, is something like this what you mean? :cool:
 

Attachments

Mile!!!
:(

I didn't think it was that bad! :( :( :(

its not hard i dont think i just dont know how to do it! :(
 

Attachments

kinda mile sept i dont want the start and stop date for the script to change just the number of days for the individual drug!!
Its cool you guys im really bad at explaining what i need to do ill work it out! thanks for helping me!!! Im a lost case me eh!!:(
 
lynsey2 said:
Mile!!! I didn't think it was that bad!

You know I'm sort of joking! ;)

Anyway, if you put an expression in the ControlSource it binds the control with that expression making it undeditable. Probablt better to do it with code, storing it in a variable.
 
sufferin soffotak! I thought it was gonna have to be a code thing!
Beeeeep!
Im not gonna be able to do this you know that eh! ill give it a bash the now and shout you if i need you! cheers guys (and again Mile)
 
Surprisingly enough I can t do this! I have wasted a lot of time trying and am stuck!

I want to fill out the Days text boxes with the number of days.

The number of days is worked out by the start date till the stop date.

This code DOES that!

=IIf(IsNull([Strength1])=False,[Forms]![ARTScript]![Stop Date]-[Forms]![ARTScript]![Start Date],"")

This code is in the Control source property setting of the text box.

THIS WORKS FINE RIGHT NOW!!!

I would like this to happen every time.

I would like to be able to select the text box and CHANGE this value if I want to.


THAT’S IT THAT ALL I WANNA DO!!!!!!!!!!!!!
 
Try not putting the expression in the ControlSource but, instead, in the DefaultValue - especially if the textbox is Unbound.
 
That's where i had it to start with and it doesnt fill out the text box Automatically with the number of days you have to type it in!!! That's why i changed it and put it in the control source. :(
What a pain!
 
What about on the form's OnCurrent() event?


remove the ControlSource and put this in the code:

Me.txtYourTextBox = IIf(IsNull([Strength1])=False,[Forms]![ARTScript]
![Stop Date]-[Forms]![ARTScript]![Start Date],"")
 
Right well that didn't work!

BUT

it gave me an idea

although this is not the best it kinda does it....

i put your code into the OnGotFocus event of the text box and it works... if fills out automaticaly and you can change it...the only problem being that it doesnt fill out till you click on the text box which could be a problem as they will forget to click on it.

That will do i suppose unless anyone has any ideas!!!!

Cheers again Mile!

Lyns :(
 
ok here's an idea...take some tic tacs and change those:( into :) sorry can't help with your thread but can't bear to see you unhappy. I would suggest alcohol but after your last thread the tic tacs seem to have the desired effect:p

ps Is it really safe to travel with you on Saturday on main roads? It's bad enough on the short trips:D
 

Users who are viewing this thread

Back
Top Bottom