473,756 Members | 6,482 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I have an expression in the query under my form to autofill the date but it wont write to the underlying table

I have an expression in the query under my form to autofill the date
under a certain condition but it wont write to the underlying table??
The date shows in the form but not the table. Does anyone know a
solution for this?

Thanks!

Sep 19 '06 #1
10 2849
On 19 Sep 2006 16:50:40 -0700, sa********@aol. com wrote:

Perhaps the control is not bound. Check the ControlSource property.
-Tom.

>I have an expression in the query under my form to autofill the date
under a certain condition but it wont write to the underlying table??
The date shows in the form but not the table. Does anyone know a
solution for this?

Thanks!
Sep 20 '06 #2
sa********@aol. com wrote in
news:11******** *************@i 42g2000cwa.goog legroups.com:
I have an expression in the query under my form to autofill
the date under a certain condition but it wont write to the
underlying table?? The date shows in the form but not the
table. Does anyone know a solution for this?

Thanks!
We are missing too many pieces of your puzzle to answer you.
If you provide us with the query's sql, and the name of the control
on the form and the structure of the table you are trying to
update, and information how you have bound the three together, then
we might have a chance to help.

However, on general principles, I question whether you even need
the expression in a query, it's usually easier to generate the
expression in the form, and simply set the value into the textbox
that's tied to the table.

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Sep 20 '06 #3
Bob Quintal wrote:
sa********@aol. com wrote in
news:11******** *************@i 42g2000cwa.goog legroups.com:
I have an expression in the query under my form to autofill
the date under a certain condition but it wont write to the
underlying table?? The date shows in the form but not the
table. Does anyone know a solution for this?

Thanks!
We are missing too many pieces of your puzzle to answer you.
If you provide us with the query's sql, and the name of the control
on the form and the structure of the table you are trying to
update, and information how you have bound the three together, then
we might have a chance to help.

However, on general principles, I question whether you even need
the expression in a query, it's usually easier to generate the
expression in the form, and simply set the value into the textbox
that's tied to the table.

--
Bob Quintal

PA is y I've altered my email address.
Hi Bob,

Thanks for your response. When I write the expression: IIf([Case
Status]="Closed", Date()) in the form instead of the query, it still
isn't writing to the table. Do I write it to the Control source for
the field or somewhere else? You mentioned to simply set the value
into the textbox? could you expound on that? I am at home now and
this is a work related problem so I don't have the structure of the
table and query to send but could you give me any further tips so I
could try it in the morning? Thanks!!!!!

Sep 20 '06 #4
Hi Again Bob,

Maybe a clearer question would be: how do I write an IIf statement in
a form control that will write to the underlying table or actually
where do I write it? I have tried directly in the control source and
it only shows in the form not on the table.

Can you help?

thanks

We are missing too many pieces of your puzzle to answer you.
If you provide us with the query's sql, and the name of the control
on the form and the structure of the table you are trying to
update, and information how you have bound the three together, then
we might have a chance to help.

However, on general principles, I question whether you even need
the expression in a query, it's usually easier to generate the
expression in the form, and simply set the value into the textbox
that's tied to the table.

--
Bob Quintal
Sep 20 '06 #5
<sa********@aol .comwrote in message
news:11******** **************@ i42g2000cwa.goo glegroups.com.. .
Hi Again Bob,

Maybe a clearer question would be: how do I write an IIf statement in
a form control that will write to the underlying table or actually
where do I write it? I have tried directly in the control source and
it only shows in the form not on the table.
If you use an expression in the Control Source of a Control, how do you
expect to bind that Control to a Field in the Form's Record Source? It is
illogical to expect either the Query or the Form to _just know_ the Field
into which you want to store the information.

Two things you can do:

(1) Write the VBA code to do the calculation in an
appropriate event -- what is "appropriat e" depends
on your particular requirements.

(2) Create another Control, bound to the Field where
you want the information stored (that Field name
in the Control's ControlSource property), set its
Visible property to "No," and in an appropriate
event, write VBA code to move the contents of the
Calculated Control to the invisible one. In your
case, this _might_ be the AfterUpdate event of
the control in which CaseStatus can be entered,
(and possibly, the OnCurrent event)

Larry Linson
Microsoft Access MVP
Sep 20 '06 #6
Hi Larry,
Thank you so much for your response. Unfortunately I don't know how to
write VBA. Everything I do has to be in query builder, forms, or
reports directly. I really need to get this done, any other
suggestions for me?

Larry Linson wrote:
<sa********@aol .comwrote in message
news:11******** **************@ i42g2000cwa.goo glegroups.com.. .
Hi Again Bob,

Maybe a clearer question would be: how do I write an IIf statement in
a form control that will write to the underlying table or actually
where do I write it? I have tried directly in the control source and
it only shows in the form not on the table.

If you use an expression in the Control Source of a Control, how do you
expect to bind that Control to a Field in the Form's Record Source? It is
illogical to expect either the Query or the Form to _just know_ the Field
into which you want to store the information.

Two things you can do:

(1) Write the VBA code to do the calculation in an
appropriate event -- what is "appropriat e" depends
on your particular requirements.

(2) Create another Control, bound to the Field where
you want the information stored (that Field name
in the Control's ControlSource property), set its
Visible property to "No," and in an appropriate
event, write VBA code to move the contents of the
Calculated Control to the invisible one. In your
case, this _might_ be the AfterUpdate event of
the control in which CaseStatus can be entered,
(and possibly, the OnCurrent event)

Larry Linson
Microsoft Access MVP
Sep 21 '06 #7
That's such simple code that it is likely that someone will write it for you
if you provide the names of the Controls involved, the name of the Field to
which the invisible Control is bound, and the circumstances under which you
want to insert today's date. If it is just on creating a new record, you
can use =Date() as the Default Value for a Field (e.g., DateCreated) but
that only works on creating a new Record, not on updating existing Records.

Larry Linson
Microsoft Access MVP
<sa********@aol .comwrote in message
news:11******** *************@b 28g2000cwb.goog legroups.com...
Hi Larry,
Thank you so much for your response. Unfortunately I don't know how to
write VBA. Everything I do has to be in query builder, forms, or
reports directly. I really need to get this done, any other
suggestions for me?

Larry Linson wrote:
><sa********@ao l.comwrote in message
news:11******* *************** @i42g2000cwa.go oglegroups.com. ..
Hi Again Bob,

Maybe a clearer question would be: how do I write an IIf statement in
a form control that will write to the underlying table or actually
where do I write it? I have tried directly in the control source and
it only shows in the form not on the table.

If you use an expression in the Control Source of a Control, how do you
expect to bind that Control to a Field in the Form's Record Source? It
is
illogical to expect either the Query or the Form to _just know_ the Field
into which you want to store the information.

Two things you can do:

(1) Write the VBA code to do the calculation in an
appropriate event -- what is "appropriat e" depends
on your particular requirements.

(2) Create another Control, bound to the Field where
you want the information stored (that Field name
in the Control's ControlSource property), set its
Visible property to "No," and in an appropriate
event, write VBA code to move the contents of the
Calculated Control to the invisible one. In your
case, this _might_ be the AfterUpdate event of
the control in which CaseStatus can be entered,
(and possibly, the OnCurrent event)

Larry Linson
Microsoft Access MVP

Sep 21 '06 #8
Hi Larry,

I actually started out by making the field default to =Date() but the
problem showed up when I realized all the records I append to the table
(which I have to do daily) automatically populated with the default
date.

I only want the date to populate the field when the record is closed.
Which is why I wrote the query to populate the "Closed Date" field when
the "Status" field has "CLOSED" entered.

But it doesn't write to the table and on requerying it only shows the
current date instead of the date it was actually closed....

Any other suggestions would be highly appreciated. Thanks again for
taking the time for simple explanations.
Larry Linson wrote:
That's such simple code that it is likely that someone will write it for you
if you provide the names of the Controls involved, the name of the Field to
which the invisible Control is bound, and the circumstances under which you
want to insert today's date. If it is just on creating a new record, you
can use =Date() as the Default Value for a Field (e.g., DateCreated) but
that only works on creating a new Record, not on updating existing Records.

Larry Linson
Microsoft Access MVP
<sa********@aol .comwrote in message
news:11******** *************@b 28g2000cwb.goog legroups.com...
Hi Larry,
Thank you so much for your response. Unfortunately I don't know how to
write VBA. Everything I do has to be in query builder, forms, or
reports directly. I really need to get this done, any other
suggestions for me?

Larry Linson wrote:
<sa********@aol .comwrote in message
news:11******** **************@ i42g2000cwa.goo glegroups.com.. .
Hi Again Bob,

Maybe a clearer question would be: how do I write an IIf statement in
a form control that will write to the underlying table or actually
where do I write it? I have tried directly in the control source and
it only shows in the form not on the table.

If you use an expression in the Control Source of a Control, how do you
expect to bind that Control to a Field in the Form's Record Source? It
is
illogical to expect either the Query or the Form to _just know_ the Field
into which you want to store the information.

Two things you can do:

(1) Write the VBA code to do the calculation in an
appropriate event -- what is "appropriat e" depends
on your particular requirements.

(2) Create another Control, bound to the Field where
you want the information stored (that Field name
in the Control's ControlSource property), set its
Visible property to "No," and in an appropriate
event, write VBA code to move the contents of the
Calculated Control to the invisible one. In your
case, this _might_ be the AfterUpdate event of
the control in which CaseStatus can be entered,
(and possibly, the OnCurrent event)

Larry Linson
Microsoft Access MVP
Sep 21 '06 #9
sa********@aol. com wrote in
news:11******** **************@ k70g2000cwa.goo glegroups.com:
Hi Larry,

I actually started out by making the field default to =Date()
but the problem showed up when I realized all the records I
append to the table (which I have to do daily) automatically
populated with the default date.

I only want the date to populate the field when the record is
closed. Which is why I wrote the query to populate the "Closed
Date" field when the "Status" field has "CLOSED" entered.

But it doesn't write to the table and on requerying it only
shows the current date instead of the date it was actually
closed....

Any other suggestions would be highly appreciated. Thanks
again for taking the time for simple explanations.
Ok, you are going to write a little bit ov Visual Basic code.
I promise you it won't hurt a bit.

First put the "closed date" field on the form. Make sure the
..control Source property is set to the field in the query or
table's name.

Second, in the properties for the "status" field find the "After
Update" box on the events tab. If you already have a macro
there, stop, otherwise click in the box, and pick "Event
Procedure" from the dropdown. You'll see an ellipse(three
periods) button to the right.Click it.

The Visual Basic (VB) editor.will open with the cursor between
two lines of code that the editor has written for you.
The upper line will start "private sub status". The lower line
will be "end sub"

In between those two lines, type:
If me.[status] = "CLOSED" then
me.[Closed Date] = date()
end if

Pretty painless? And now you can add writing Visual Basic
programs to your resumé.
..
Using the After Update event of the "Status" box is so the date
will only get written when you change the status.
--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Sep 21 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5781
by: Russell | last post by:
I'm having a fit with a query for a range of dates. The dates are being returned from a view. The table/field that they are being selected from stores them as varchar and that same field also stores other fields from our dynamic forms. The field is called 'FormItemAnswer' and stores text, integer, date, float, etc. Anything the user can type into one of our web forms. The query looks like, select distinct from...
3
5395
by: Harvey | last post by:
Hi, I try to write an asp query form that lets client search any text-string and display all pages in my web server that contain the text. I have IIS 6.0 on a server 2003. The MSDN site says there is a sample file called Ixtrasp.asp, but I could not find it in my system although I installed indexing service. I followed the steps in MSDN site to create a basic .asp query form (too long to post it here), but it always displays: No...
4
6818
by: Andy Hutchings | last post by:
Hi everybody - hope you can help out here. I have a form in a database, which is a columnar form from one of the tables in the db - there is a sub-form to the form which is a datasheet view of another table in the db. The LinkChilds property is set to show connected records from both tables. What I'd like to do is copy and paste, or use some other method of writing, the contents of one field in one table in the form, to a field in the...
3
1770
by: JC Mugs | last post by:
Help needed for project-Access 2002(office xp) PROBLEM: Figuring out how to lookup a record and DDate field in Table1 - Take that DDate-field data from record looked up and assign it to Date field in a new record on a form using Table2. BASIC Table1 Fields: DID -Primary KEY DDate --Information I need to move to new form
4
1884
by: Trey | last post by:
How do I tell an update query to only search the records that are older then the current record? I need to figure out how to write a query that will take a record, look to see if any record with an older date and time has the same address, then marks a yes/no box to YES if it does not find a duplicate. I know this can be done, I just don't know how. I know it will take a subquery of some kind. I am just lost. Any help would
7
2276
by: J-P-W | last post by:
Hi, in the past I've spent ages writing VB routines to get around this problem, is there a simple way? I have three tables for a membership system: tblMembership - MembershipNumber; Names etc tblMembershipSubsHeader - "AmountDue" ; whether the pay by standing order and so on tblMembershipSubs - PaymentYear ; DatePaid; AmountPaid
28
16419
by: Marc Gravell | last post by:
In Linq, you can apparently get a meaningful body from and expression's .ToString(); random question - does anybody know if linq also includes a parser? It just seemed it might be a handy way to write a safe but easy implementation (i.e. no codedom) for an IBindingListView.Filter (by compiling to a Predicate<T>). Anybody know if this is possible at all? Marc
6
1732
by: Dameon99 | last post by:
Ive been looking through a whole tonne of sites to try to find out how I can make my fields mandatory but havnt been able to find something so far which actually tells me whwta I want to know. Ive tried a couple of code segments but they havnt been working. can anyone tell me how I can make fields in my code mandatory? My attempt at solving this is below: <html> <head> <title>Coals Spiral Brochure Enquiry Form</title>
4
4586
by: zion4ever | last post by:
Hello good people, Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet reservation of available resources (laptops, beamers, etc). The MySql database queries are already in place, as is the ASP administration panel. The frontend that users will see however, still needs some work. I'm really close, but since I'm no...
0
9462
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9287
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9857
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9722
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6542
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5155
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3817
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3369
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2677
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.