UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Filling A Field From A Combo Box Column Or A Text Field If Combo Box Not Used, Office 2007    
 
   
johnp
post Jun 23 2011, 02:24 PM
Post #1

UtterAccess Addict
Posts: 177
From: Maine



This is a goofy problem, i am sure.

I have an entry field called Pat_Medication, behind that entry field is a combo box with multiple columns. If they select one of the values in the combo box, I fill various other fields from the columns. This works great, they can use the combo box values, or enter a value manually. i want to fill a field called Pat_Med_Generic with the data in column 8, if the user uses the combo box pull down, if they don't, i want to put the value that was manually entered in the Pat_Medication field into the field Pat_Med_Generic.



My logic looks like this:
CODE
Me.Pat_Med_Generic = Me.Medication_ID_Combo.Column(8)

'Add logic to check to see if blank, if blank will fill with data from field Pat_Medication

If Me.Pat_Med_Generic Is blank Then
Me.Pat_Med_Generic = Me.Pat_Medication
End If


The first part,
Me.Pat_Med_Generic = Me.Medication_ID_Combo.Column(8) works fine, its just i am trying to tell the program, if they don't use a value in the combo box, i.e. enter it manually, then put the value entered in the field Me.Pat_Medication into the Me.Pat_Med_Generic field.


Any suggestions, or see what I am doing wrong?





I tried to use me.pat_med_Generic is null, or is " " but either way, it either gives me an error or will not fill the field. I also tried if Me.Medication_ID_Combo.Column(8) is blank or null or " " but neither seemed to work properly.





Any suggestions?
Thanks in advance!

Go to the top of the page
 
+
LionelRoodyn
post Jun 23 2011, 03:26 PM
Post #2

New Member
Posts: 6



Try using the OnNotInList event
Go to the top of the page
 
+
johnp
post Jun 24 2011, 03:46 PM
Post #3

UtterAccess Addict
Posts: 177
From: Maine



QUOTE (LionelRoodyn @ Jun 23 2011, 04:26 PM) *
Try using the OnNotInList event

Thanks but that didn't work, i think the On Not in list will only work if the combo field properties are set to * 'limit to list' which mine is not.


* site that indicates this: http://www.databasedev.co.UK/not_in_list.html

This post has been edited by johnp: Jun 24 2011, 03:46 PM
Go to the top of the page
 
+
yougee5a3a
post Jun 25 2011, 09:56 AM
Post #4

UtterAccess Member
Posts: 42



in my logic, user entered manually to Pat_Medication field then will choose or not the Medication_ID_Combo
if it's then i think you just need 2 events for handle it

First :
Private Sub Pat_Medication_AfterUpdate()
Me.Pat_Med_Generic = Me.Pat_Medication
End Sub

Second :
Private Sub Medication_ID_Combo_AfterUpdate()
If IsNull(Me.Medication_ID_Combo) Or Me.Medication_ID_Combo.Value = "" Then
Me.Pat_Med_Generic = Me.Pat_Medication
Else
Me.Pat_Med_Generic = Me.Medication_ID_Combo.Column(8)
End If
End Sub

Just in my logic (IMG:style_emoticons/default/hat_tip.gif)
Regards,

'Gie
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 22nd May 2013 - 08:44 PM