473,883 Members | 2,361 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems Saving Multiple Unbound Fields to a Table

Hi,

Im wondering if anyone can help me with a problem.
I have a form with more than 50 unbound fields.
Some of the fields will be blank from time to time.
This seems to be where im having trouble.
I have tried keeping some of the fields bound and when I use the save button
it has been saving as 2 different records. This is unacceptable.

This is what I have, can anyone help me out with this?

=============== =============== =============== =============== ===

Private Sub Command226_Clic k()
On Error GoTo Err_Command226_ Click
Dim Dbs As Database
Dim RstFrmAddEntry As Recordset
Dim QryFrmAddEntry As String

Set Dbs = OpenDatabase("C :\LOCATION OF MY FILE\File.mdb")
QryFrmAddEntry = "Table1"
Set RstFrmAddEntry = Dbs.OpenRecords et(QryFrmAddEnt ry, dbOpenDynaset)
With RstFrmAddEntry
.AddNew
!TripNumber = TripNumber.Valu e
!DateDispatched = DateDispatched. Value
!DateCompleted = DateCompleted.V alue
!Advance = Advance.Value
!TripType = TripType.Value
!MilesPaid = MilesPaid.Value
!Origin = Origin.Value
!TripPay = TripPay.Value
!Drop1Loc = Drop1Loc.Value
!Drop1Type = Drop1Type.Value
!Drop1Rate = Drop1Rate.Value
!Drop1Miles = Drop1Miles.Valu e
!Drop1Pay = Drop1Pay.Value
!Drop2Loc = Drop2Loc.Value
!Drop2Type = Drop2Type.Value
!Drop2Rate = Drop2Rate.Value
!Drop2Miles = Drop2Mile.Value
!Drop2Pay = Drop2Pay.Value
!Drop3Loc = Drop3Loc.Value
!Drop3Type = Drop3Type.Value
!Drop3Rate = Drop3Rate.Value
!Drop3Miles = Drop3Miles.Valu e
!Drop3Pay = Drop3Pay.Value
!Drop4Loc = Drop4Loc.Value
!Drop4Type = Drop4Type.Value
!Drop4Rate = Drop4Rate.Value
!Drop4Miles = Drop4Miles.Valu e
!Drop4Pay = Drop4Pay.Value
!UndeckPay = UndeckPay.Value
!ReDeckPay = ReDeckPay.Value
!DelayType1 = DelayType1.Valu e
!DelayHrs1 = DelayHrs1.Value
!DelayPay1 = DelayPay1.Value
!DelayType2 = DelayType2.Valu e
!DelayHrs2 = DelayHrs2.Value
!DelayPay2 = DelayPay2.Value
!DelayType3 = DelayType3.Valu e
!DelayHrs3 = DelayHrs3.Value
!DelayPay3 = DelayPay3.Value
!LayOverRate = LayOverRate.Val ue
!LayoverHrs = LayoverHrs.Valu e
!LayoverPay = LayoverPay.Valu e
!OutOfRoute = OutOfRoute.Valu e
!OutOfRoutez = OutOfRoutez.Val ue
!Taxi = Taxi.Value
!Tolls = Tolls.Value
!ATM = ATM.Value
!Fuel = Fuel.Value
!Misc = Misc.Value
!TotalReimburse ments = TotalReimbursem ents.Value
!Notes = Notes.Value
.Update
.Close
End With

Err_Command226_ Click:
MsgBox Err.Description
Exit Sub

End Sub

=============== =============== =============== =============== =

Thanks in advance for your help.
Torque!
Apr 16 '06
18 3813
"TORQUE" <To****@home.or g> wrote
First I want to say I appreciate your input here. For
that matter anyone who offers help without insulting
the intelligence of the person asking for help.
A primary point in my response was that Piet was _not_ insulting your
intelligence, nor was he calling your question "stupid". I do not see your
acceptance of that, nor the apology that I think is due Piet.

Neither am I calling your question stupid, but I am calling the information
you provided in the initial question and in this followup "insufficie ntly
complete and insufficiently detailed" for anyone here to be of much help.
Well, im not sure how you mean to be more clear.
You have to tell us what you have and what you want to do in specific,
detailed terms. I thought I was reasonably specific in telling you what we
need to be able to help you.
Some fields that have the same name with the exception
of having the numbers beside them, these are some of
the more common fields that may not always be needed,
or may not apply to a specific trip.


I have not the vaguest idea of what fields might be needed for your
particular application, nor how the code would determine whether a specific
field is or is not needed for a particular "trip". And, to be honest, none
of us here really have the time or energy to play guessing games as to what
someone is asking. I did that, in part, on my first response and you did not
reply as to whether my assumption was correct, incorrect, or whether it was
helpful.

If you want us to be able to help you (and that's why many of us participate
here), you need to give us the information we need. We don't know what your
application is, we don't know what data you are keeping, and we don't know
whether a field with the "same name but a number beside it" is entered at
the user's option or if depending on some other field, it _must_ be entered.
And the only way we are going to know is if you tell us. Sometimes, when we
ask for specific details, it is the person who was asking the question who
comes up with their own answer.

Could it be, for example, if the trip type is "Safari" or
"Mountainclimbi ng", another field, "Licensed Guide" would be required? Or,
is it just if there is an entry in "Licensed Guide", the assumption would be
that a licensed guide is required for that type of trip?

Larry Linson
Microsoft Access MVP
Apr 16 '06 #11
TORQUE <To****@home.or g> wrote in
news:8g******** *************** *********@4ax.c om:
Im wondering if anyone can help me with a problem.
I have a form with more than 50 unbound fields.
Some of the fields will be blank from time to time.
This seems to be where im having trouble.
I have tried keeping some of the fields bound and when I use the
save button it has been saving as 2 different records. This is
unacceptable.


Why are you using an unbound form in the first place? What do you
hope to gain by that? There must be a reason, as coding unbound
forms is much more complicated than using bound forms.

Second, in your code, you refer to the controls on the form by name
without specifying the form. You should refer to them as
Me!DateDispatch ed.Value or Me.DateDispatch ed.Value (I prefer the
former). And I see no reason to specify the .Value property, as this
is the default value of all controls, so Me!DateDispatch ed should
suffice,

Third, if you don't want to update fields that haven't changed or
don't have values, then just test for whether or not the field is
blank or unchanged. I usually do this with something like this:

If Nz(rs!Field,vbN ullString) <> Nz(Me!Control,v bNullString) Then
rs!Field = Me!Control
End If

This can be automated in a loop through the controls if the
controlnames are the same as the names of the unbound controls:

Dim ctl As Control
Dim strName As String

For Each ctl In Me.Controls
strName = ctl.Name
If Nz(rs(strName), vbNullString) <> Nz(ctl,vbNullSt ring) Then
rs(strName) = ctl
End If
Next ctl

Set ctl = Nothing

Of course, not all controls on your form may be used for editing
fields in your record, so you'd have to control that somehow. I
usually set up one or more custom collections, populated by looping
through Me.Controls (as above) and checking the .Tag property (which
I set to indicate which collection they belong in).

Last of all, the error you're having is probably happening because
you're attempting to close the recordset inside the With block.
Change the end from:

.Close
End With

to

End With
RstFrmAddEntry. Close

And add:

Set RstFrmAddEntry = Nothing
Dbs.Close
Set Dbs = Nothing

And it should work.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Apr 16 '06 #12
On Sun, 16 Apr 2006 16:14:10 GMT, "Larry Linson" <bo*****@localh ost.not> wrote:
"TORQUE" <To****@home.or g> wrote
First I want to say I appreciate your input here. For
that matter anyone who offers help without insulting
the intelligence of the person asking for help.
A primary point in my response was that Piet was _not_ insulting your
intelligence , nor was he calling your question "stupid". I do not see your
acceptance of that, nor the apology that I think is due Piet.


Well, I took it as an insult. If I misunderstood, I appologize.
Neither am I calling your question stupid, but I am calling the information
you provided in the initial question and in this followup "insufficie ntly
complete and insufficiently detailed" for anyone here to be of much help.
Well, im not sure how you mean to be more clear.
You have to tell us what you have and what you want to do in specific,
detailed terms. I thought I was reasonably specific in telling you what we
need to be able to help you.


I am trying to keep track of each trip I make, I always have 1 drop, but can have as many as 4.
I am just trying to keep up with each trip individually. Keeping track of All miles for each drop.

Sometimes I have delays, sometimes I do not.
Some fields that have the same name with the exception
of having the numbers beside them, these are some of
the more common fields that may not always be needed,
or may not apply to a specific trip.


BTW, I have Changed the form back to being bound. The reason I went with an unbound form was because of an
article I read on a website which mentioned something about the fact that sometimes a form will save fields automatically
before your actually ready to save the fields. Does this make any sense?

Anyhow, I changed it back, but, I have 10 fields that I want to do calculations automatically, which the calculating works fine,
but it will not save the results of the field to the table. I thought if I could not get those 10 to save to the table, I would be
able to create an entire form that I can save all the fields at 1 time with just a single button. This way has proven to be more
trouble thatn what I thought to be after visiting here: accessdatabaset ips.com/unbound-forms-1.html
I have not the vaguest idea of what fields might be needed for your
particular application, nor how the code would determine whether a specific
field is or is not needed for a particular "trip". And, to be honest, none
of us here really have the time or energy to play guessing games as to what
someone is asking. I did that, in part, on my first response and you did not
reply as to whether my assumption was correct, incorrect, or whether it was
helpful.
My calculated fields are: TripPay, Drop1Pay, Drop2Pay, Drop3Pay, Drop4Pay, Delaypay1, DelayPay2, DelayPay3,
LayOverPay, and TotalReimbursem ents.
If you want us to be able to help you (and that's why many of us participate
here), you need to give us the information we need. We don't know what your
application is, we don't know what data you are keeping, and we don't know
whether a field with the "same name but a number beside it" is entered at
the user's option or if depending on some other field, it _must_ be entered.
And the only way we are going to know is if you tell us. Sometimes, when we
ask for specific details, it is the person who was asking the question who
comes up with their own answer.

Could it be, for example, if the trip type is "Safari" or
"Mountainclimb ing", another field, "Licensed Guide" would be required? Or,
is it just if there is an entry in "Licensed Guide", the assumption would be
that a licensed guide is required for that type of trip?

Larry Linson
Microsoft Access MVP

Thanks Larry
TORQUE
Apr 17 '06 #13
On Sun, 16 Apr 2006 14:27:26 -0500, "David W. Fenton" <XX*******@dfen ton.com.invalid > wrote:
TORQUE <To****@home.or g> wrote in
news:8g******* *************** **********@4ax. com:
Im wondering if anyone can help me with a problem.
I have a form with more than 50 unbound fields.
Some of the fields will be blank from time to time.
This seems to be where im having trouble.
I have tried keeping some of the fields bound and when I use the
save button it has been saving as 2 different records. This is
unacceptable.
Why are you using an unbound form in the first place? What do you
hope to gain by that? There must be a reason, as coding unbound
forms is much more complicated than using bound forms.


Well, a website for tips on Access suggested it, so I thought it might work.
Seems to be more problems. www dot accessdatabaset ips dot com slash forms dot html
Second, in your code, you refer to the controls on the form by name
without specifying the form. You should refer to them as
Me!DateDispatc hed.Value or Me.DateDispatch ed.Value (I prefer the
former). And I see no reason to specify the .Value property, as this
is the default value of all controls, so Me!DateDispatch ed should
suffice,
What is the whole ( Me! statements)? I dont understand this.
This is what I am working on " home dot carolina dot rr dot com slash pcmed"
Third, if you don't want to update fields that haven't changed or
don't have values, then just test for whether or not the field is
blank or unchanged. I usually do this with something like this:
I have changed the form back to the way it was and bound it to my table.
It's my calculated fields that I am trying to get them to be saved to the table.
If Nz(rs!Field,vbN ullString) <> Nz(Me!Control,v bNullString) Then
rs!Field = Me!Control
End If

This can be automated in a loop through the controls if the
controlnames are the same as the names of the unbound controls:

Dim ctl As Control
Dim strName As String

For Each ctl In Me.Controls
strName = ctl.Name
If Nz(rs(strName), vbNullString) <> Nz(ctl,vbNullSt ring) Then
rs(strName) = ctl
End If
Next ctl

Set ctl = Nothing

Of course, not all controls on your form may be used for editing
fields in your record, so you'd have to control that somehow. I
usually set up one or more custom collections, populated by looping
through Me.Controls (as above) and checking the .Tag property (which
I set to indicate which collection they belong in).

Last of all, the error you're having is probably happening because
you're attempting to close the recordset inside the With block.
Change the end from:

.Close
End With

to

End With
RstFrmAddEntry. Close

And add:

Set RstFrmAddEntry = Nothing
Dbs.Close
Set Dbs = Nothing

And it should work.

Apr 17 '06 #14
I am going to top-post and leave the details below, for convenience.

Yes, saving calculated Controls (that is, if the calculation is specified in
the Control Source) is definitely a problem. Generally, it shouldn't be
done, but the calculations re-done at the time you need to use the value.
The exception to this would be a calculation done using factors that are not
available, or may have been changed, by the time the calculated value is
used.

You may not like this, but it _appears_ to me that you have an unnormalized
design, too, which can cause you problems in the long run. It's very likely
that you should have a Trip table with separate, related records for Drops
and Delays (though if a delay is associated with the drop, then it might be
a Field in the Drop record). Bear in mind that an unnormalized design is
likely to cause you more trouble later than fixing it now would be.

All that said... if you have values that are calculated based on an
expression in their Control Source, there isn't anywhere to specify the
Field in the RecordSource to which they are bound. The answer is to add
TextBoxes with their Visible property set to False/No which are bound to a
Field in the Recordsource, one for each Calculated Control that you want to
Save. Put VBA code in the AfterUpdate event of the Calculated Control, or
the LostFocus event, if AfterUpdate proves to be a problem to copy the value
of the Calculated Control to the Invisible Text Box.

And, if you do encounter problems later that relate to the design, we will
try to deal with those.

Now, I _think_ I understood the problem, and the implications as to the
specs... for example, if a Drop2 is entered, and a Delay 1 is entered, then
they are needed, but there's no way, other than their being entered to
determine that they are needed and _enforce_ that they are entered. If I
have misunderstood, please explain.

Larry Linson
Microsoft Access MVP
"TORQUE" <To****@home.or g> wrote in message
news:u3******** *************** *********@4ax.c om...
On Sun, 16 Apr 2006 16:14:10 GMT, "Larry Linson" <bo*****@localh ost.not>
wrote:
"TORQUE" <To****@home.or g> wrote
> First I want to say I appreciate your input here. For
> that matter anyone who offers help without insulting
> the intelligence of the person asking for help.


A primary point in my response was that Piet was _not_ insulting your
intelligenc e, nor was he calling your question "stupid". I do not see
your
acceptance of that, nor the apology that I think is due Piet.


Well, I took it as an insult. If I misunderstood, I appologize.
Neither am I calling your question stupid, but I am calling the
information
you provided in the initial question and in this followup "insufficie ntly
complete and insufficiently detailed" for anyone here to be of much help.
> Well, im not sure how you mean to be more clear.


You have to tell us what you have and what you want to do in specific,
detailed terms. I thought I was reasonably specific in telling you what we
need to be able to help you.


I am trying to keep track of each trip I make, I always have 1 drop, but
can have as many as 4.
I am just trying to keep up with each trip individually. Keeping track of
All miles for each drop.

Sometimes I have delays, sometimes I do not.
> Some fields that have the same name with the exception
> of having the numbers beside them, these are some of
> the more common fields that may not always be needed,
> or may not apply to a specific trip.


BTW, I have Changed the form back to being bound. The reason I went with
an unbound form was because of an
article I read on a website which mentioned something about the fact that
sometimes a form will save fields automatically
before your actually ready to save the fields. Does this make any sense?

Anyhow, I changed it back, but, I have 10 fields that I want to do
calculations automatically, which the calculating works fine,
but it will not save the results of the field to the table. I thought if I
could not get those 10 to save to the table, I would be
able to create an entire form that I can save all the fields at 1 time
with just a single button. This way has proven to be more
trouble thatn what I thought to be after visiting here:
accessdatabaset ips.com/unbound-forms-1.html
I have not the vaguest idea of what fields might be needed for your
particular application, nor how the code would determine whether a
specific
field is or is not needed for a particular "trip". And, to be honest, none
of us here really have the time or energy to play guessing games as to
what
someone is asking. I did that, in part, on my first response and you did
not
reply as to whether my assumption was correct, incorrect, or whether it
was
helpful.


My calculated fields are: TripPay, Drop1Pay, Drop2Pay, Drop3Pay, Drop4Pay,
Delaypay1, DelayPay2, DelayPay3,
LayOverPay, and TotalReimbursem ents.
If you want us to be able to help you (and that's why many of us
participate
here), you need to give us the information we need. We don't know what
your
application is, we don't know what data you are keeping, and we don't know
whether a field with the "same name but a number beside it" is entered at
the user's option or if depending on some other field, it _must_ be
entered.
And the only way we are going to know is if you tell us. Sometimes, when
we
ask for specific details, it is the person who was asking the question who
comes up with their own answer.

Could it be, for example, if the trip type is "Safari" or
"Mountainclim bing", another field, "Licensed Guide" would be required? Or,
is it just if there is an entry in "Licensed Guide", the assumption would
be
that a licensed guide is required for that type of trip?

Larry Linson
Microsoft Access MVP

Thanks Larry
TORQUE

Apr 17 '06 #15
On Mon, 17 Apr 2006 05:04:54 GMT, "Larry Linson" <bo*****@localh ost.not> wrote:
I am going to top-post and leave the details below, for convenience.

Yes, saving calculated Controls (that is, if the calculation is specified in
the Control Source) is definitely a problem. Generally, it shouldn't be
done, but the calculations re-done at the time you need to use the value.
The exception to this would be a calculation done using factors that are not
available, or may have been changed, by the time the calculated value is
used.

You may not like this, but it _appears_ to me that you have an unnormalized
design, too, which can cause you problems in the long run. It's very likely
that you should have a Trip table with separate, related records for Drops
and Delays (though if a delay is associated with the drop, then it might be
a Field in the Drop record). Bear in mind that an unnormalized design is
likely to cause you more trouble later than fixing it now would be.
I dont mind you saying this, but, can you explain to me what you mean by
unnormalized design? Without input from people who know what they are
doing, I could not improve on my techniques. If you dont mind elaborating
some on the unnormalized design. I have some snaps of what I am working
on posted, maybe this may give you a better perspective of the design.
http colon slash slash home dot carolina dot rr dot com slash pcmed.
Hope it is okay to put the site in here the way I did.
All that said... if you have values that are calculated based on an
expression in their Control Source, there isn't anywhere to specify the
Field in the RecordSource to which they are bound. The answer is to add
TextBoxes with their Visible property set to False/No which are bound to a
Field in the Recordsource, one for each Calculated Control that you want to
Save. Put VBA code in the AfterUpdate event of the Calculated Control, or
the LostFocus event, if AfterUpdate proves to be a problem to copy the value
of the Calculated Control to the Invisible Text Box.
I believe I know what you are talking about. Let me know if I do or dont. I have
created a couple of extra text fields with the calculations under the fields where
I want the calculations to go. In order for me to get that calculation to save into
my table, I have to manually copy the answer into the proper fields.
I am actually very good with Excel and calculations. Access is proving to be
quite a challenge for me. But this is what keeps me going. I like a challenge.

( Put VBA code in the AfterUpdate event of the Calculated Control, or
the LostFocus event ) I understand what ur saying here, but do not know how
to do this sort of thing.
And, if you do encounter problems later that relate to the design, we will
try to deal with those.

Now, I _think_ I understood the problem, and the implications as to the
specs... for example, if a Drop2 is entered, and a Delay 1 is entered, then
they are needed, but there's no way, other than their being entered to
determine that they are needed and _enforce_ that they are entered. If I
have misunderstood, please explain.
I do think you are understanding my problem. And this was the reason I was trying
to come up with a [Save Button] to do the job. And I have done this, but with more
problems, It save the selected fields, but as a completely different entry, and not as
the same entry with all the other information. Does this make sense to you?
Larry Linson
Microsoft Access MVP

Once again I want to say Thankyou for your correspondence.
Robert Dodgens

"TORQUE" <To****@home.or g> wrote in message
news:u3******* *************** **********@4ax. com...
On Sun, 16 Apr 2006 16:14:10 GMT, "Larry Linson" <bo*****@localh ost.not>
wrote:
"TORQUE" <To****@home.or g> wrote

> First I want to say I appreciate your input here. For
> that matter anyone who offers help without insulting
> the intelligence of the person asking for help.

A primary point in my response was that Piet was _not_ insulting your
intelligence , nor was he calling your question "stupid". I do not see
your
acceptance of that, nor the apology that I think is due Piet.


Well, I took it as an insult. If I misunderstood, I appologize.
Neither am I calling your question stupid, but I am calling the
informatio n
you provided in the initial question and in this followup "insufficie ntly
complete and insufficiently detailed" for anyone here to be of much help.

> Well, im not sure how you mean to be more clear.

You have to tell us what you have and what you want to do in specific,
detailed terms. I thought I was reasonably specific in telling you what we
need to be able to help you.


I am trying to keep track of each trip I make, I always have 1 drop, but
can have as many as 4.
I am just trying to keep up with each trip individually. Keeping track of
All miles for each drop.

Sometimes I have delays, sometimes I do not.
> Some fields that have the same name with the exception
> of having the numbers beside them, these are some of
> the more common fields that may not always be needed,
> or may not apply to a specific trip.


BTW, I have Changed the form back to being bound. The reason I went with
an unbound form was because of an
article I read on a website which mentioned something about the fact that
sometimes a form will save fields automatically
before your actually ready to save the fields. Does this make any sense?

Anyhow, I changed it back, but, I have 10 fields that I want to do
calculations automatically, which the calculating works fine,
but it will not save the results of the field to the table. I thought if I
could not get those 10 to save to the table, I would be
able to create an entire form that I can save all the fields at 1 time
with just a single button. This way has proven to be more
trouble thatn what I thought to be after visiting here:
accessdatabaset ips.com/unbound-forms-1.html
I have not the vaguest idea of what fields might be needed for your
particular application, nor how the code would determine whether a
specific
field is or is not needed for a particular "trip". And, to be honest, none
of us here really have the time or energy to play guessing games as to
what
someone is asking. I did that, in part, on my first response and you did
not
reply as to whether my assumption was correct, incorrect, or whether it
was
helpful.


My calculated fields are: TripPay, Drop1Pay, Drop2Pay, Drop3Pay, Drop4Pay,
Delaypay1, DelayPay2, DelayPay3,
LayOverPay, and TotalReimbursem ents.
If you want us to be able to help you (and that's why many of us
participat e
here), you need to give us the information we need. We don't know what
your
applicatio n is, we don't know what data you are keeping, and we don't know
whether a field with the "same name but a number beside it" is entered at
the user's option or if depending on some other field, it _must_ be
entered.
And the only way we are going to know is if you tell us. Sometimes, when
we
ask for specific details, it is the person who was asking the question who
comes up with their own answer.

Could it be, for example, if the trip type is "Safari" or
"Mountaincli mbing", another field, "Licensed Guide" would be required? Or,
is it just if there is an entry in "Licensed Guide", the assumption would
be
that a licensed guide is required for that type of trip?

Larry Linson
Microsoft Access MVP

Thanks Larry
TORQUE

Apr 17 '06 #16
TORQUE <To****@home.or g> wrote in
news:dk******** *************** *********@4ax.c om:
On Sun, 16 Apr 2006 14:27:26 -0500, "David W. Fenton"
<XX*******@dfen ton.com.invalid > wrote:
TORQUE <To****@home.or g> wrote in
news:8g****** *************** ***********@4ax .com:
Im wondering if anyone can help me with a problem.
I have a form with more than 50 unbound fields.
Some of the fields will be blank from time to time.
This seems to be where im having trouble.
I have tried keeping some of the fields bound and when I use the
save button it has been saving as 2 different records. This is
unacceptable.
Why are you using an unbound form in the first place? What do you
hope to gain by that? There must be a reason, as coding unbound
forms is much more complicated than using bound forms.


Well, a website for tips on Access suggested it, so I thought it
might work. Seems to be more problems. www dot accessdatabaset ips
dot com slash forms dot html


That site doesn't discuss the reason for using unbound forms, and
explicitly says it won't. There is no need to go to an advanced
method (which is what coding unbound forms is) unless the normal
approaches are causing problems. I"ve been coding Access apps for
clients since 1996, and I've written maybe a half dozen unbound
forms for data editing in that whole period.
Second, in your code, you refer to the controls on the form by
name without specifying the form. You should refer to them as
Me!DateDispat ched.Value or Me.DateDispatch ed.Value (I prefer the
former). And I see no reason to specify the .Value property, as
this is the default value of all controls, so Me!DateDispatch ed
should suffice,


What is the whole ( Me! statements)? I dont understand this. . . .


Well, when you refer to a control without the Me, it's unclear what
it is. It could be a function, it could be a subroutine, any number
of things. The "Me" keyword refers to the module in which you're
doing your coding. In a form's VBA module, "Me" refers to the form
the module is attached to. In a report, Me refers to the report. It
can also be used in a class module, but that's an advanced topic --
it cannot be used in a standalone VBA module that is not a class
module.

I see that you were just copying the code from the website you cite
above. Let me tell you that the practice of leaving off the Me
reference shows that the site you were using was coded by someone
who is not very good at what he does. I have never seen a published
Access book use unqualified control references in that fashion. It's
something I've only seen in code produced by a programmer who was
unprofessional, and/or inexperienced.

Those terms would have applied to me back in 1996, but by reading
books on Access and code posted in this newsgroup, I learned to do
better.
. . . This is what I am working on " home dot carolina dot rr dot
com slash pcmed"
I don't see anything there except a list of home pages. What are you
intending to refer to?
Third, if you don't want to update fields that haven't changed or
don't have values, then just test for whether or not the field is
blank or unchanged. I usually do this with something like this:


I have changed the form back to the way it was and bound it to my
table.


That will make it easier.
It's my calculated fields that I am trying to get them to be saved
to the table.


Most calculated values oughtn't be stored. The only calculations you
should store are ones that are based on information gathered at the
time the record is edited that could change over time (such as a
sales tax amount, which might be based on a rate that changes over
time).

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Apr 17 '06 #17

"TORQUE" <To****@home.or g> wrote in message
news:50******** *************** *********@4ax.c om...
On Mon, 17 Apr 2006 05:04:54 GMT, "Larry Linson" <bo*****@localh ost.not>
wrote:
You may not like this, but it _appears_ to me that you have an
unnormalize d
design, too, which can cause you problems in the long run. It's very
likely
that you should have a Trip table with separate, related records for Drops
and Delays (though if a delay is associated with the drop, then it might
be
a Field in the Drop record). Bear in mind that an unnormalized design is
likely to cause you more trouble later than fixing it now would be.


I dont mind you saying this, but, can you explain to me what you mean by
unnormalized design? Without input from people who know what they are
doing, I could not improve on my techniques. If you dont mind elaborating
some on the unnormalized design. I have some snaps of what I am working
on posted, maybe this may give you a better perspective of the design.
http colon slash slash home dot carolina dot rr dot com slash pcmed.
Hope it is okay to put the site in here the way I did.


Try
http://www.devhood.com/tutorials/tut...tutorial_id=95
Apr 17 '06 #18
On Mon, 17 Apr 2006 14:18:33 -0500, "David W. Fenton" <XX*******@dfen ton.com.invalid > wrote:
TORQUE <To****@home.or g> wrote in
news:dk******* *************** **********@4ax. com:
On Sun, 16 Apr 2006 14:27:26 -0500, "David W. Fenton"
<XX*******@dfen ton.com.invalid > wrote:
TORQUE <To****@home.or g> wrote in
news:8g***** *************** ************@4a x.com:

Im wondering if anyone can help me with a problem.
I have a form with more than 50 unbound fields.
Some of the fields will be blank from time to time.
This seems to be where im having trouble.
I have tried keeping some of the fields bound and when I use the
save button it has been saving as 2 different records. This is
unacceptable.

Why are you using an unbound form in the first place? What do you
hope to gain by that? There must be a reason, as coding unbound
forms is much more complicated than using bound forms.


Well, a website for tips on Access suggested it, so I thought it
might work. Seems to be more problems. www dot accessdatabaset ips
dot com slash forms dot html


That site doesn't discuss the reason for using unbound forms, and
explicitly says it won't. There is no need to go to an advanced
method (which is what coding unbound forms is) unless the normal
approaches are causing problems. I"ve been coding Access apps for
clients since 1996, and I've written maybe a half dozen unbound
forms for data editing in that whole period.
Second, in your code, you refer to the controls on the form by
name without specifying the form. You should refer to them as
Me!DateDispa tched.Value or Me.DateDispatch ed.Value (I prefer the
former). And I see no reason to specify the .Value property, as
this is the default value of all controls, so Me!DateDispatch ed
should suffice,


What is the whole ( Me! statements)? I dont understand this. . . .


Well, when you refer to a control without the Me, it's unclear what
it is. It could be a function, it could be a subroutine, any number
of things. The "Me" keyword refers to the module in which you're
doing your coding. In a form's VBA module, "Me" refers to the form
the module is attached to. In a report, Me refers to the report. It
can also be used in a class module, but that's an advanced topic --
it cannot be used in a standalone VBA module that is not a class
module.

I see that you were just copying the code from the website you cite
above. Let me tell you that the practice of leaving off the Me
reference shows that the site you were using was coded by someone
who is not very good at what he does. I have never seen a published
Access book use unqualified control references in that fashion. It's
something I've only seen in code produced by a programmer who was
unprofessional , and/or inexperienced.

Those terms would have applied to me back in 1996, but by reading
books on Access and code posted in this newsgroup, I learned to do
better.
. . . This is what I am working on " home dot carolina dot rr dot
com slash pcmed"


I don't see anything there except a list of home pages. What are you
intending to refer to?

http://home.carolina.rr.com/pcmed/
Third, if you don't want to update fields that haven't changed or
don't have values, then just test for whether or not the field is
blank or unchanged. I usually do this with something like this:


I have changed the form back to the way it was and bound it to my
table.


That will make it easier.
It's my calculated fields that I am trying to get them to be saved
to the table.


Most calculated values oughtn't be stored. The only calculations you
should store are ones that are based on information gathered at the
time the record is edited that could change over time (such as a
sales tax amount, which might be based on a rate that changes over
time).

Apr 17 '06 #19

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

Similar topics

1
1857
by: InDeSkize | last post by:
Hello my programming Super Heroes. I think this one is a no brainer, me being the one with no brain. I have a form that is used for data entry. The goal is to have an unbound form that only enters the record when you hit the "Save Record" button. I've been using a form that enters right into the table, and I'm running into too many problems with Multiple Primary Keys and
6
7142
by: Andy | last post by:
Hello, I am having many problems with setting up a parameter query that searches by the criteria entered or returns all records if nothing is entered. I have designed an unbound form with 3 fields on it: Date (DateSpan1 and DateSpan2), Originator, and GroupName. I have added a button that triggers a query and uses those fields as its parameter criteria to populate a form. The user must be allowed to either enter all of the
5
2955
by: David | last post by:
Hi I seem to be getting nowhere with this. I am opening a form which will be used to input Notes into different fields in a table. My problem is changing the unbound field name to the field name in the associated table that this form is based on. Is there anyway I can do this with vba ? I am using a different button object to open this form for the field it is to update. button1 updates unbound field name from text1 to 101Commnets...
3
2763
by: google | last post by:
I'm developing an application for use within my company in Access 2003. I'm new to '03, the application I did for my former employer was in '97. The two applications have similar functionality (we're sales offices, and I'm doing things such as associate directories, commission calculations, order tracking, etc.). 2003 seems to have a few extra features, but I seem to continually run in to oddities that seem like they SHOULD work, but...
6
10505
by: ApexData | last post by:
I have 2 tables: Table1 and Table2. Neither one has a primary key because each table will only have 1-record. My form is a SingleForm unbound with tabs (my desire here). Using this form, in the Record Source I originally had the statement TABLE1, and all worked fine. Now I want to open the second table as well, and this is where my problem is.
2
9455
by: angie | last post by:
I need to figure out how to create a user interface to search a query, but here's the bad part...I need to account for criteria on at least 7 of the fields. Here's what I'm thinking I need to do: Create an unbound form with unbound fields for all 7 of the fields in the query. Then in the query create parameters that refer to those fields. But it's not that simple because the user needs the flexibility of filling in as many or as few...
2
1390
by: keri | last post by:
Hi everyone, I've started a new topic so as not to get people confused. I apologise for the number of posts i've put on here over the last few days - i really am trying to learn this stuff but my brain is getting a bit frazzled. I have a form based on the table appointments with fields as below AppointmentNo (primary key - autonumber)
2
3070
by: Presto | last post by:
I am making a front end mdb so users can enter new members data. I can then import this into the master database on the backend and erase the existing info on the front end to keep the data reasonably secure. ( I borrowed the code from http://www.databasedev.co.uk/unbound-forms-add-data.html example) I have 4 tables that will be updated from this form: Members ContactInfo Payments
2
2083
by: Radu | last post by:
Hi. I have an Access application which does lots of things by going through some PINS in some large tables. This application is installed on multiple computers, and works fine, with one exception: For reporting purposes, I need to keep a "central" table where each application would save some data. Currently I'm using a LINKED excel file named "SharedAccumulator" and after each PIN successfully processed a record is added in the...
0
9953
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
11166
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10768
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10422
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
9588
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7980
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7137
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
6009
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3242
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.