=?Utf-8?B?UGF0cmljaw==?= <
[email protected]>
wrote in
I deleted the 2nd "=" and now the red lines are gone, but the
field doen't update in the table. Actually the form
[Reference #] doesn't update either. I have a date of
8/12/2007 and a table letter of A and I am trying to get that
to be 081207A, which works with the =format.... in the control
of the reference # text box. I see what you are doing and I
understand why it should work, but why it's not working is
beyond me. What do you suggest I try next? Is there more
information that I can give you to help out?
Thanks again.
Some things to check: Access usually names the textboxes on a
form with the name of the field to which it's bound, but not
always. Sometimes the # sign can confuse Access.
Open the Properties popup and verify the name of each textbox,
it is on the 'Other' tab.
Also check that the control source for the textbox that receives
the data is is the correct field in the table. That's on the
'Data tab'
Thirdly, check that the AfterUpdate events have the words [Event
Procedure] in them. You can turn off an event procedure, but
still leave the code in the module.
:
=?Utf-8?B?UGF0cmljaw==?= <
[email protected]>
wrote in
Bob, I appreciate you staying with me on this one.
Here is what I have in the event procedure for afterupdate
on Date Processed: Private Sub Date_Processed_AfterUpdate()
Me.[Reference #] = =Format([Date Processed],"mmddyy") &
[Table Letter]
End Sub
And this is what I have for the event procedure for
afterupdate on Table Letter:
Private Sub Table_Letter_AfterUpdate()
Me.[Reference #] = =Format([Date Processed],"mmddyy") &
[Table Letter]
End Sub
I am getting a compile error:
expected: expression and it is highlighting the 2nd = on
each statement along with the entire Me.[Reference #] =
=Format([Date Processed],"mmddyy") & [Table Letter] being
in all red.
OOPS. When I pasted the code I forgot to delete the second =
. There should be only one.
:
=?Utf-8?B?UGF0cmljaw==?=
More help please,
I have a table titled [test update fruit master] and
have created a form called [test update fruit master
form]. In the table there is a field named [reference
#] and in the form I changed the control source for the
[reference #] to =Format([Date Processed],"mmddyy") &
[Table Letter]. There is a test box for [Date
Processed] and one for [Table Letter]. I am combining
the 2 test boxes to create the [Reference #] in the
form. I need the created Reference # to carry to the
field in the table. This number will join multiple
tables together if I can get this done. I very
new to programming even worse than knowing enough to be
dangerous.
How do I add the code to the form that you listed below?
First change the reference in the textbox from
=Format([Date Processed],"mmddyy") & [Table Letter]
to [reference #]
Click once on the [date processed] textbox.
Now, open the Properties popup menu for the form.
Click on the Events tab
click in the AfterUpdate event,
Choose Event Procedure from the dropdown
Click on the elipsis (...) button to the right.
The Visual Basic editor will open.
paste
Me.[Reference #] = =Format([Date Processed],"mmddyy") &
[Table Letter]
between the two lines that the editor put:
Private sub reference___AfterUpdate()
End Sub
Repeat wirh [Table Letter] instead of [Reference #]
save the code, then save the form.
:
In the form, you run some code to calculate some value.
The last line of that calculation needs to set either a
textbox which is bound to a field in the table or set
the field in the table directly. You would go to the
field directly if you have the field in hte
recordsource but it is not shown on hte form.
To set to a textbox,
me.textboxname = ResultofCalculation
to set to a field
me!fieldname = ResultofCalculation
After doing whichever of those , do the me.dirty =
false to save the record.