control source to update text box

G

Guest

How do you get a control source in a form to update a text box in a table? I
have a form created from a table and need the control source in the form to
update the field in the table.
 
M

missinglinq via AccessMonster.com

Simplified:

Forms have Controls, such as textboxes (tables don't have textboxes)

Tables have fields.

A bound form has a table as its Record Source. Controls on the form have
Control Sources, which are fields from the Record Source table. When a record
is saved, by moving to a different/new record, closing the form or explicitly
saving the record (thru VBA code) the value of a textbox is saved to its
field in the underlying table.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
G

Guest

so how do I close the form or save the form thru VBA code? I still need help
skinning the cat, I didn't bring the correct knife!
 
B

Bob Quintal

=?Utf-8?B?UGF0cmljaw==?= <[email protected]>
wrote in
so how do I close the form or save the form thru VBA code? I
still need help skinning the cat, I didn't bring the correct
knife!

To save data from a form to a table you can simply set the
form's dirty property.
me.dirty =False
 
G

Guest

I set the dirty property to what you said, but that doesn't update the table
field.
How do you get a control source in a form to update a field in a table? I
have a form created from a table and need the control source in the form to
update the field in the table.
I am so lost!!
 
B

Bob Quintal

=?Utf-8?B?UGF0cmljaw==?= <[email protected]>
wrote in
I set the dirty property to what you said, but that doesn't
update the table field.
How do you get a control source in a form to update a field in
a table? I have a form created from a table and need the
control source in the form to update the field in the table.
I am so lost!!

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.
Bob Quintal said:
=?Utf-8?B?UGF0cmljaw==?= <[email protected]>
wrote in


To save data from a form to a table you can simply set the
form's dirty property.
me.dirty =False
 
B

Bob Quintal

=?Utf-8?B?UGF0cmljaw==?= <[email protected]>
wrote in
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.
 
G

Guest

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?

:
 
G

Guest

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.

Bob Quintal said:
=?Utf-8?B?UGF0cmljaw==?= <[email protected]>
wrote in
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.
 
B

Bob Quintal

=?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.


Bob Quintal said:
=?Utf-8?B?UGF0cmljaw==?= <[email protected]>
wrote in
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.
 
G

Guest

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.

Bob Quintal said:
=?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.


Bob Quintal said:
=?Utf-8?B?UGF0cmljaw==?= <[email protected]>
wrote in

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.
 
B

Bob Quintal

=?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.
Bob Quintal said:
=?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.
 
G

Guest

Everything seems to be the same. The name [Reference #], [Date Processed]
and [Table Letter] are all in the other tab, control source and the event
procedure is still in the events tab. What should I look at next?

Bob Quintal said:
=?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.
Bob Quintal said:
=?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.
 
B

Bob Quintal

Everything seems to be the same. The name [Reference #], [Date
Processed] and [Table Letter] are all in the other tab, control
source and the event procedure is still in the events tab. What
should I look at next?
I'd open the form's module in design view, then put the cursor in
the Private Sub Date_Processed_AfterUpdate() line, and press the F9
key. That sets a breakpoint Set the form to normal view, and add a
new record. enter the date_processed. the code module should pop up
and when you press F8, you will execute 1 line of code. Press F8
repeatedly to move through the code, and see if it does something
funny, such as jumping to an error handler.

Q

Bob Quintal said:
=?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.
 
G

Guest

I pressed the F9 key where you said and I get a popup that states that "fruit
inventory can't find the macro 'me'." The macro or it's group doesn't exist
or the macro is new but hasn't been saved. I don't know what this is and it
won't let me move further without this popping up. What do I do with that?

Bob Quintal said:
Everything seems to be the same. The name [Reference #], [Date
Processed] and [Table Letter] are all in the other tab, control
source and the event procedure is still in the events tab. What
should I look at next?
I'd open the form's module in design view, then put the cursor in
the Private Sub Date_Processed_AfterUpdate() line, and press the F9
key. That sets a breakpoint Set the form to normal view, and add a
new record. enter the date_processed. the code module should pop up
and when you press F8, you will execute 1 line of code. Press F8
repeatedly to move through the code, and see if it does something
funny, such as jumping to an error handler.

Q

Bob Quintal said:
=?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.
 
B

Bob Quintal

I pressed the F9 key where you said and I get a popup that states
that "fruit inventory can't find the macro 'me'." The macro or
it's group doesn't exist or the macro is new but hasn't been
saved. I don't know what this is and it won't let me move further
without this popping up. What do I do with that?
Is the code in the form's code module? This behaviour says no, it's in
a general module.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top