Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / March 2007

Tip: Looking for answers? Try searching our database.

Fill in table using an iff statement from a sub form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nanette - 14 Mar 2007 21:38 GMT
I have a subform that has a text box "txtProgramName" that has
"=IIf(Forms!frmContracts!RFQType='R',"NGSS Material Replacements","NGSS COSAL
Material Replacements")" as its Control Source.

I need the correct choice to fill in the table tblLineItem.

How is this done?
Mark A. Sam - 15 Mar 2007 13:37 GMT
Many ways, but here is one.  On the Dirty property of the subform:

[myTextBox] =IIf(Forms!frmContracts!RFQType='R',"NGSS Material
Replacements","NGSS COSAL
Material Replacements")

Or you can place it in the AfterUpdate event of a control on the subform.
[myTextBox] is the Textbox on the subform you wish to populate.  If you want
to populate [txtProgramName] then you need to clear the ControlSource
property of the textbox.

God Bless,

Mark A. Sam

>I have a subform that has a text box "txtProgramName" that has
> "=IIf(Forms!frmContracts!RFQType='R',"NGSS Material Replacements","NGSS
[quoted text clipped - 4 lines]
>
> How is this done?
Nanette - 15 Mar 2007 16:11 GMT
Hi Mark,

Thanks for answering. Apparently I didn't explain myself very well. I
already have the code " [myTextBox] =IIf(Forms!frmContracts!RFQType='R',"NGSS
Material
Replacements","NGSS COSAL Material Replacements") in my form.

What is not happening is the data is not being put into the source table.
So, although I see "NGSS Material Replacements" in the text box on the form,
the data is not being put into the underlying table. I thought it did this
automatically, but it isn't happening.

Any other suggestions?

> Many ways, but here is one.  On the Dirty property of the subform:
>
[quoted text clipped - 19 lines]
> >
> > How is this done?
Mark A. Sam - 15 Mar 2007 17:29 GMT
Hello Nanette,

Is it your understanding that setting the ControlSource value of a textbox
to "= WhateverValue" will place data into a table?  It won't.  The purpose
is to display a value in a textbox for the user's information.  If you want
to place the data into a table, you should use Code to place it into the
table by populated a control  on a form, like in the example I gave or
through DAO, which are methods for addressing tables.

> Hi Mark,
>
[quoted text clipped - 36 lines]
>> >
>> > How is this done?
Nanette - 15 Mar 2007 18:42 GMT
Hi Mark,

Guess I didn't understand your first message. I tried putting the code
"[txtProgramName] =IIf(Forms!frmContracts!RFQType='R',"NGSS Material
Replacements","NGSS COSAL Material Replacements")" into the Dirty option on
the SubForm, made sure the ControlSource was empty, and now I'm getting the
message that the Macro can't be found.

I've only been working full time in Access databases for 6 months now and am
wondering if I should try something different. I just don't seem to
understand some things :-((

> Hello Nanette,
>
[quoted text clipped - 45 lines]
> >> >
> >> > How is this done?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.