Object required running SQL Update

H

Hugh self taught

Hi Brainy people,

My mind is spinning because I can't see the fault.

On my form is an unbound text box with =[EvtCplID].[Column](0) which
reflects the correct value.

I have a save button & need to save the reflected value in the bound tables
field EvtMale. I can't seem to get the syntax to set the field value = to the
reflected value before the save.

I then set about doing an update after the save (which I've done in other
databases before but in slightly more simple circumstances) & get an "Object
Required" error. The VB command is thus

DoCmd.RunSQL ("UPDATE tblEvtInput SET EvtMale =" & Couples.MaleID & " WHERE
Couples.CoupleID =" & [Forms]![frmEvtInput]![EvtMale])

I had it in concatenated format & had a syntax error there so in haste I
just made it one long line to test with. The fields names are correct & the
form name is correct. The cbo above gets it's data from the Couples table.

Any suggestions may save what little hair I have left...
 
H

Hugh self taught

Hello Douglas,

You seem to be a regular saviour for me.

Is it not possible to set the value before the "save"?

In the interim I fiddled around with other ways of getting the correct value
updated & was successful with the "Update". I then moved on to setting those
values when I want to add a new record. I copied the code directly & can't
fathom out why the male value gets saved but not the female. Below is the code

Private Sub btnNextRes_Click()
On Error GoTo Err_btnNextRes_Click

EvtFemale = Me!EvtCplFem
EvtMale = Me!EvtCplMan

DoCmd.GoToRecord , , acNewRec

On my form both male & female text boxes reflect the correct values yet in
the table only the male field has a value in it. The update procedure writes
both values to the respective fields but not the above proc.

Any suggestions where I might start to look? My hair is thinning at a rate
of knotts at the moment.

Tks

Douglas J. Steele said:
See whether it works without the parentheses around the SQL statement.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Hugh self taught said:
Hi Brainy people,

My mind is spinning because I can't see the fault.

On my form is an unbound text box with =[EvtCplID].[Column](0) which
reflects the correct value.

I have a save button & need to save the reflected value in the bound
tables
field EvtMale. I can't seem to get the syntax to set the field value = to
the
reflected value before the save.

I then set about doing an update after the save (which I've done in other
databases before but in slightly more simple circumstances) & get an
"Object
Required" error. The VB command is thus

DoCmd.RunSQL ("UPDATE tblEvtInput SET EvtMale =" & Couples.MaleID & "
WHERE
Couples.CoupleID =" & [Forms]![frmEvtInput]![EvtMale])

I had it in concatenated format & had a syntax error there so in haste I
just made it one long line to test with. The fields names are correct &
the
form name is correct. The cbo above gets it's data from the Couples table.

Any suggestions may save what little hair I have left...
 
H

Hugh self taught

Just a note, you'll see that from one text box I progressed to two & renamed
them. The first was just to get the procedure working.

Douglas J. Steele said:
See whether it works without the parentheses around the SQL statement.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Hugh self taught said:
Hi Brainy people,

My mind is spinning because I can't see the fault.

On my form is an unbound text box with =[EvtCplID].[Column](0) which
reflects the correct value.

I have a save button & need to save the reflected value in the bound
tables
field EvtMale. I can't seem to get the syntax to set the field value = to
the
reflected value before the save.

I then set about doing an update after the save (which I've done in other
databases before but in slightly more simple circumstances) & get an
"Object
Required" error. The VB command is thus

DoCmd.RunSQL ("UPDATE tblEvtInput SET EvtMale =" & Couples.MaleID & "
WHERE
Couples.CoupleID =" & [Forms]![frmEvtInput]![EvtMale])

I had it in concatenated format & had a syntax error there so in haste I
just made it one long line to test with. The fields names are correct &
the
form name is correct. The cbo above gets it's data from the Couples table.

Any suggestions may save what little hair I have left...
 
D

Douglas J. Steele

Sorry, no idea. What are EvtFemale and EvtMale supposed to be?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Hugh self taught said:
Hello Douglas,

You seem to be a regular saviour for me.

Is it not possible to set the value before the "save"?

In the interim I fiddled around with other ways of getting the correct
value
updated & was successful with the "Update". I then moved on to setting
those
values when I want to add a new record. I copied the code directly & can't
fathom out why the male value gets saved but not the female. Below is the
code

Private Sub btnNextRes_Click()
On Error GoTo Err_btnNextRes_Click

EvtFemale = Me!EvtCplFem
EvtMale = Me!EvtCplMan

DoCmd.GoToRecord , , acNewRec

On my form both male & female text boxes reflect the correct values yet in
the table only the male field has a value in it. The update procedure
writes
both values to the respective fields but not the above proc.

Any suggestions where I might start to look? My hair is thinning at a rate
of knotts at the moment.

Tks

Douglas J. Steele said:
See whether it works without the parentheses around the SQL statement.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Hugh self taught said:
Hi Brainy people,

My mind is spinning because I can't see the fault.

On my form is an unbound text box with =[EvtCplID].[Column](0) which
reflects the correct value.

I have a save button & need to save the reflected value in the bound
tables
field EvtMale. I can't seem to get the syntax to set the field value =
to
the
reflected value before the save.

I then set about doing an update after the save (which I've done in
other
databases before but in slightly more simple circumstances) & get an
"Object
Required" error. The VB command is thus

DoCmd.RunSQL ("UPDATE tblEvtInput SET EvtMale =" & Couples.MaleID & "
WHERE
Couples.CoupleID =" & [Forms]![frmEvtInput]![EvtMale])

I had it in concatenated format & had a syntax error there so in haste
I
just made it one long line to test with. The fields names are correct &
the
form name is correct. The cbo above gets it's data from the Couples
table.

Any suggestions may save what little hair I have left...
 
H

Hugh self taught

Me!EvtCplFem refers to a text box on my form with source
=[EvtCplID].[Column](5) and Me!EvtCplMan is =[EvtCplID].[Column](4)

EvtFemale & EvtMale are fields in tblEvtInput. The EvtMale field gets
written with the correct data but the EvtFemale field in the table remains
blank despite the text box reflecting the correct data there. I also don't
get any error messages. I can't understand it. The scenario of both sets of
variables are identical yet one defies logic by not being applied.

As I tried to explain in my earlier post, when I update these fields by way
of a DoCmd.Runsql update they both get updated.

I'm really at a loss on this one

Douglas J. Steele said:
Sorry, no idea. What are EvtFemale and EvtMale supposed to be?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Hugh self taught said:
Hello Douglas,

You seem to be a regular saviour for me.

Is it not possible to set the value before the "save"?

In the interim I fiddled around with other ways of getting the correct
value
updated & was successful with the "Update". I then moved on to setting
those
values when I want to add a new record. I copied the code directly & can't
fathom out why the male value gets saved but not the female. Below is the
code

Private Sub btnNextRes_Click()
On Error GoTo Err_btnNextRes_Click

EvtFemale = Me!EvtCplFem
EvtMale = Me!EvtCplMan

DoCmd.GoToRecord , , acNewRec

On my form both male & female text boxes reflect the correct values yet in
the table only the male field has a value in it. The update procedure
writes
both values to the respective fields but not the above proc.

Any suggestions where I might start to look? My hair is thinning at a rate
of knotts at the moment.

Tks

Douglas J. Steele said:
See whether it works without the parentheses around the SQL statement.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


message Hi Brainy people,

My mind is spinning because I can't see the fault.

On my form is an unbound text box with =[EvtCplID].[Column](0) which
reflects the correct value.

I have a save button & need to save the reflected value in the bound
tables
field EvtMale. I can't seem to get the syntax to set the field value =
to
the
reflected value before the save.

I then set about doing an update after the save (which I've done in
other
databases before but in slightly more simple circumstances) & get an
"Object
Required" error. The VB command is thus

DoCmd.RunSQL ("UPDATE tblEvtInput SET EvtMale =" & Couples.MaleID & "
WHERE
Couples.CoupleID =" & [Forms]![frmEvtInput]![EvtMale])

I had it in concatenated format & had a syntax error there so in haste
I
just made it one long line to test with. The fields names are correct &
the
form name is correct. The cbo above gets it's data from the Couples
table.

Any suggestions may save what little hair I have left...
 
D

Douglas J. Steele

Access has no way of know that EvtFemale and EvtMale refers to fields in a
table in:

EvtFemale = Me!EvtCplFem
EvtMale = Me!EvtCplMan

As far as Access is concerned, EvtFemale and EvtMale are variables. Why
EvtMale is getting updated in your table is a mystery to me, but I can
guarantee it has nothing to do with those two lines of code.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Hugh self taught said:
Me!EvtCplFem refers to a text box on my form with source
=[EvtCplID].[Column](5) and Me!EvtCplMan is =[EvtCplID].[Column](4)

EvtFemale & EvtMale are fields in tblEvtInput. The EvtMale field gets
written with the correct data but the EvtFemale field in the table remains
blank despite the text box reflecting the correct data there. I also don't
get any error messages. I can't understand it. The scenario of both sets
of
variables are identical yet one defies logic by not being applied.

As I tried to explain in my earlier post, when I update these fields by
way
of a DoCmd.Runsql update they both get updated.

I'm really at a loss on this one

Douglas J. Steele said:
Sorry, no idea. What are EvtFemale and EvtMale supposed to be?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Hugh self taught said:
Hello Douglas,

You seem to be a regular saviour for me.

Is it not possible to set the value before the "save"?

In the interim I fiddled around with other ways of getting the correct
value
updated & was successful with the "Update". I then moved on to setting
those
values when I want to add a new record. I copied the code directly &
can't
fathom out why the male value gets saved but not the female. Below is
the
code

Private Sub btnNextRes_Click()
On Error GoTo Err_btnNextRes_Click

EvtFemale = Me!EvtCplFem
EvtMale = Me!EvtCplMan

DoCmd.GoToRecord , , acNewRec

On my form both male & female text boxes reflect the correct values yet
in
the table only the male field has a value in it. The update procedure
writes
both values to the respective fields but not the above proc.

Any suggestions where I might start to look? My hair is thinning at a
rate
of knotts at the moment.

Tks

:

See whether it works without the parentheses around the SQL statement.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


message Hi Brainy people,

My mind is spinning because I can't see the fault.

On my form is an unbound text box with =[EvtCplID].[Column](0) which
reflects the correct value.

I have a save button & need to save the reflected value in the bound
tables
field EvtMale. I can't seem to get the syntax to set the field value
=
to
the
reflected value before the save.

I then set about doing an update after the save (which I've done in
other
databases before but in slightly more simple circumstances) & get an
"Object
Required" error. The VB command is thus

DoCmd.RunSQL ("UPDATE tblEvtInput SET EvtMale =" & Couples.MaleID &
"
WHERE
Couples.CoupleID =" & [Forms]![frmEvtInput]![EvtMale])

I had it in concatenated format & had a syntax error there so in
haste
I
just made it one long line to test with. The fields names are
correct &
the
form name is correct. The cbo above gets it's data from the Couples
table.

Any suggestions may save what little hair I have left...
 
H

Hugh self taught

Okay. So what I'm trying to do is write to table those two variables along
with the bound values from my form when I go to "add a new record"

I'm not sure how to accomplish that bound & unbound write to record. Any
simple suggestions?

Douglas J. Steele said:
Access has no way of know that EvtFemale and EvtMale refers to fields in a
table in:

EvtFemale = Me!EvtCplFem
EvtMale = Me!EvtCplMan

As far as Access is concerned, EvtFemale and EvtMale are variables. Why
EvtMale is getting updated in your table is a mystery to me, but I can
guarantee it has nothing to do with those two lines of code.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Hugh self taught said:
Me!EvtCplFem refers to a text box on my form with source
=[EvtCplID].[Column](5) and Me!EvtCplMan is =[EvtCplID].[Column](4)

EvtFemale & EvtMale are fields in tblEvtInput. The EvtMale field gets
written with the correct data but the EvtFemale field in the table remains
blank despite the text box reflecting the correct data there. I also don't
get any error messages. I can't understand it. The scenario of both sets
of
variables are identical yet one defies logic by not being applied.

As I tried to explain in my earlier post, when I update these fields by
way
of a DoCmd.Runsql update they both get updated.

I'm really at a loss on this one

Douglas J. Steele said:
Sorry, no idea. What are EvtFemale and EvtMale supposed to be?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


message Hello Douglas,

You seem to be a regular saviour for me.

Is it not possible to set the value before the "save"?

In the interim I fiddled around with other ways of getting the correct
value
updated & was successful with the "Update". I then moved on to setting
those
values when I want to add a new record. I copied the code directly &
can't
fathom out why the male value gets saved but not the female. Below is
the
code

Private Sub btnNextRes_Click()
On Error GoTo Err_btnNextRes_Click

EvtFemale = Me!EvtCplFem
EvtMale = Me!EvtCplMan

DoCmd.GoToRecord , , acNewRec

On my form both male & female text boxes reflect the correct values yet
in
the table only the male field has a value in it. The update procedure
writes
both values to the respective fields but not the above proc.

Any suggestions where I might start to look? My hair is thinning at a
rate
of knotts at the moment.

Tks

:

See whether it works without the parentheses around the SQL statement.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


message Hi Brainy people,

My mind is spinning because I can't see the fault.

On my form is an unbound text box with =[EvtCplID].[Column](0) which
reflects the correct value.

I have a save button & need to save the reflected value in the bound
tables
field EvtMale. I can't seem to get the syntax to set the field value
=
to
the
reflected value before the save.

I then set about doing an update after the save (which I've done in
other
databases before but in slightly more simple circumstances) & get an
"Object
Required" error. The VB command is thus

DoCmd.RunSQL ("UPDATE tblEvtInput SET EvtMale =" & Couples.MaleID &
"
WHERE
Couples.CoupleID =" & [Forms]![frmEvtInput]![EvtMale])

I had it in concatenated format & had a syntax error there so in
haste
I
just made it one long line to test with. The fields names are
correct &
the
form name is correct. The cbo above gets it's data from the Couples
table.

Any suggestions may save what little hair I have left...
 
D

Douglas J. Steele

Running a SQL Update statement would probably be the best way (sorry: you
mention "As I tried to explain in my earlier post", but I don't know which
post that is)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Hugh self taught said:
Okay. So what I'm trying to do is write to table those two variables along
with the bound values from my form when I go to "add a new record"

I'm not sure how to accomplish that bound & unbound write to record. Any
simple suggestions?

Douglas J. Steele said:
Access has no way of know that EvtFemale and EvtMale refers to fields in
a
table in:

EvtFemale = Me!EvtCplFem
EvtMale = Me!EvtCplMan

As far as Access is concerned, EvtFemale and EvtMale are variables. Why
EvtMale is getting updated in your table is a mystery to me, but I can
guarantee it has nothing to do with those two lines of code.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Hugh self taught said:
Me!EvtCplFem refers to a text box on my form with source
=[EvtCplID].[Column](5) and Me!EvtCplMan is =[EvtCplID].[Column](4)

EvtFemale & EvtMale are fields in tblEvtInput. The EvtMale field gets
written with the correct data but the EvtFemale field in the table
remains
blank despite the text box reflecting the correct data there. I also
don't
get any error messages. I can't understand it. The scenario of both
sets
of
variables are identical yet one defies logic by not being applied.

I tried to explain in my earlier post, when I update these fields by
way
of a DoCmd.Runsql update they both get updated.

I'm really at a loss on this one

:

Sorry, no idea. What are EvtFemale and EvtMale supposed to be?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


message Hello Douglas,

You seem to be a regular saviour for me.

Is it not possible to set the value before the "save"?

In the interim I fiddled around with other ways of getting the
correct
value
updated & was successful with the "Update". I then moved on to
setting
those
values when I want to add a new record. I copied the code directly &
can't
fathom out why the male value gets saved but not the female. Below
is
the
code

Private Sub btnNextRes_Click()
On Error GoTo Err_btnNextRes_Click

EvtFemale = Me!EvtCplFem
EvtMale = Me!EvtCplMan

DoCmd.GoToRecord , , acNewRec

On my form both male & female text boxes reflect the correct values
yet
in
the table only the male field has a value in it. The update
procedure
writes
both values to the respective fields but not the above proc.

Any suggestions where I might start to look? My hair is thinning at
a
rate
of knotts at the moment.

Tks

:

See whether it works without the parentheses around the SQL
statement.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


in
message Hi Brainy people,

My mind is spinning because I can't see the fault.

On my form is an unbound text box with =[EvtCplID].[Column](0)
which
reflects the correct value.

I have a save button & need to save the reflected value in the
bound
tables
field EvtMale. I can't seem to get the syntax to set the field
value
=
to
the
reflected value before the save.

I then set about doing an update after the save (which I've done
in
other
databases before but in slightly more simple circumstances) & get
an
"Object
Required" error. The VB command is thus

DoCmd.RunSQL ("UPDATE tblEvtInput SET EvtMale =" & Couples.MaleID
&
"
WHERE
Couples.CoupleID =" & [Forms]![frmEvtInput]![EvtMale])

I had it in concatenated format & had a syntax error there so in
haste
I
just made it one long line to test with. The fields names are
correct &
the
form name is correct. The cbo above gets it's data from the
Couples
table.

Any suggestions may save what little hair I have left...
 
H

Hugh self taught

Yeah, I'm falling over my tongue a bit. Too busy fiddling trying to get the
last intricate bits to work so I can wrap this one up & get it producing the
info I'm designing it for.

Along the way I've changed variable names & methodology to try achieve the
correct result & hopefully by the best method. I have an idea on the sql
update as you mention but I was hoping there was a more direct route.

BTW I tried a suggestion found elsewhere in the forums regarding the use of
db.execute as opposed to RunSQL posted by John Vinson & got an error along
the lines of "object expected (1)" or was parameter expected.... can't recall
exactly. I just got ticked off & changed it back to runsql. If you know of a
decent reference to using that method I can go look at, I'd appreciated the
heads up.

Thanks for the assistance once again. You guys do an awesome job getting us
uniformed mortals down the road of database development.


Douglas J. Steele said:
Running a SQL Update statement would probably be the best way (sorry: you
mention "As I tried to explain in my earlier post", but I don't know which
post that is)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Hugh self taught said:
Okay. So what I'm trying to do is write to table those two variables along
with the bound values from my form when I go to "add a new record"

I'm not sure how to accomplish that bound & unbound write to record. Any
simple suggestions?

Douglas J. Steele said:
Access has no way of know that EvtFemale and EvtMale refers to fields in
a
table in:

EvtFemale = Me!EvtCplFem
EvtMale = Me!EvtCplMan

As far as Access is concerned, EvtFemale and EvtMale are variables. Why
EvtMale is getting updated in your table is a mystery to me, but I can
guarantee it has nothing to do with those two lines of code.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


message Me!EvtCplFem refers to a text box on my form with source
=[EvtCplID].[Column](5) and Me!EvtCplMan is =[EvtCplID].[Column](4)

EvtFemale & EvtMale are fields in tblEvtInput. The EvtMale field gets
written with the correct data but the EvtFemale field in the table
remains
blank despite the text box reflecting the correct data there. I also
don't
get any error messages. I can't understand it. The scenario of both
sets
of
variables are identical yet one defies logic by not being applied.

I tried to explain in my earlier post, when I update these fields by
way
of a DoCmd.Runsql update they both get updated.

I'm really at a loss on this one

:

Sorry, no idea. What are EvtFemale and EvtMale supposed to be?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


message Hello Douglas,

You seem to be a regular saviour for me.

Is it not possible to set the value before the "save"?

In the interim I fiddled around with other ways of getting the
correct
value
updated & was successful with the "Update". I then moved on to
setting
those
values when I want to add a new record. I copied the code directly &
can't
fathom out why the male value gets saved but not the female. Below
is
the
code

Private Sub btnNextRes_Click()
On Error GoTo Err_btnNextRes_Click

EvtFemale = Me!EvtCplFem
EvtMale = Me!EvtCplMan

DoCmd.GoToRecord , , acNewRec

On my form both male & female text boxes reflect the correct values
yet
in
the table only the male field has a value in it. The update
procedure
writes
both values to the respective fields but not the above proc.

Any suggestions where I might start to look? My hair is thinning at
a
rate
of knotts at the moment.

Tks

:

See whether it works without the parentheses around the SQL
statement.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


in
message Hi Brainy people,

My mind is spinning because I can't see the fault.

On my form is an unbound text box with =[EvtCplID].[Column](0)
which
reflects the correct value.

I have a save button & need to save the reflected value in the
bound
tables
field EvtMale. I can't seem to get the syntax to set the field
value
=
to
the
reflected value before the save.

I then set about doing an update after the save (which I've done
in
other
databases before but in slightly more simple circumstances) & get
an
"Object
Required" error. The VB command is thus

DoCmd.RunSQL ("UPDATE tblEvtInput SET EvtMale =" & Couples.MaleID
&
"
WHERE
Couples.CoupleID =" & [Forms]![frmEvtInput]![EvtMale])

I had it in concatenated format & had a syntax error there so in
haste
I
just made it one long line to test with. The fields names are
correct &
the
form name is correct. The cbo above gets it's data from the
Couples
table.

Any suggestions may save what little hair I have left...
 
D

Douglas J. Steele

Unless you've got bound controls, I don't think you have any choice but to
use SQL.

To my mind, though, db.execute is definitely better than RunSQL for two
reasons:

1) You don't get the annoying "You're about to update n records..." pop-up
(sure, you can use SetWarnings to get around that, but then you have to
remember to turn the warnings back on)
2) You get a trappable error if something's wrong with the SQL or with its
execution.

I'd recommend trying to get it to work and, if you can't, posting back here
(to a new thread, since this is buried fairly deeply now)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Hugh self taught said:
Yeah, I'm falling over my tongue a bit. Too busy fiddling trying to get
the
last intricate bits to work so I can wrap this one up & get it producing
the
info I'm designing it for.

Along the way I've changed variable names & methodology to try achieve the
correct result & hopefully by the best method. I have an idea on the sql
update as you mention but I was hoping there was a more direct route.

BTW I tried a suggestion found elsewhere in the forums regarding the use
of
db.execute as opposed to RunSQL posted by John Vinson & got an error along
the lines of "object expected (1)" or was parameter expected.... can't
recall
exactly. I just got ticked off & changed it back to runsql. If you know of
a
decent reference to using that method I can go look at, I'd appreciated
the
heads up.

Thanks for the assistance once again. You guys do an awesome job getting
us
uniformed mortals down the road of database development.


Douglas J. Steele said:
Running a SQL Update statement would probably be the best way (sorry: you
mention "As I tried to explain in my earlier post", but I don't know
which
post that is)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Hugh self taught said:
Okay. So what I'm trying to do is write to table those two variables
along
with the bound values from my form when I go to "add a new record"

I'm not sure how to accomplish that bound & unbound write to record.
Any
simple suggestions?

:

Access has no way of know that EvtFemale and EvtMale refers to fields
in
a
table in:

EvtFemale = Me!EvtCplFem
EvtMale = Me!EvtCplMan

As far as Access is concerned, EvtFemale and EvtMale are variables.
Why
EvtMale is getting updated in your table is a mystery to me, but I can
guarantee it has nothing to do with those two lines of code.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


message Me!EvtCplFem refers to a text box on my form with source
=[EvtCplID].[Column](5) and Me!EvtCplMan is =[EvtCplID].[Column](4)

EvtFemale & EvtMale are fields in tblEvtInput. The EvtMale field
gets
written with the correct data but the EvtFemale field in the table
remains
blank despite the text box reflecting the correct data there. I also
don't
get any error messages. I can't understand it. The scenario of both
sets
of
variables are identical yet one defies logic by not being applied.

I tried to explain in my earlier post, when I update these fields
by
way
of a DoCmd.Runsql update they both get updated.

I'm really at a loss on this one

:

Sorry, no idea. What are EvtFemale and EvtMale supposed to be?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


in
message Hello Douglas,

You seem to be a regular saviour for me.

Is it not possible to set the value before the "save"?

In the interim I fiddled around with other ways of getting the
correct
value
updated & was successful with the "Update". I then moved on to
setting
those
values when I want to add a new record. I copied the code
directly &
can't
fathom out why the male value gets saved but not the female.
Below
is
the
code

Private Sub btnNextRes_Click()
On Error GoTo Err_btnNextRes_Click

EvtFemale = Me!EvtCplFem
EvtMale = Me!EvtCplMan

DoCmd.GoToRecord , , acNewRec

On my form both male & female text boxes reflect the correct
values
yet
in
the table only the male field has a value in it. The update
procedure
writes
both values to the respective fields but not the above proc.

Any suggestions where I might start to look? My hair is thinning
at
a
rate
of knotts at the moment.

Tks

:

See whether it works without the parentheses around the SQL
statement.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


"Hugh self taught" <[email protected]>
wrote
in
message
Hi Brainy people,

My mind is spinning because I can't see the fault.

On my form is an unbound text box with =[EvtCplID].[Column](0)
which
reflects the correct value.

I have a save button & need to save the reflected value in the
bound
tables
field EvtMale. I can't seem to get the syntax to set the field
value
=
to
the
reflected value before the save.

I then set about doing an update after the save (which I've
done
in
other
databases before but in slightly more simple circumstances) &
get
an
"Object
Required" error. The VB command is thus

DoCmd.RunSQL ("UPDATE tblEvtInput SET EvtMale =" &
Couples.MaleID
&
"
WHERE
Couples.CoupleID =" & [Forms]![frmEvtInput]![EvtMale])

I had it in concatenated format & had a syntax error there so
in
haste
I
just made it one long line to test with. The fields names are
correct &
the
form name is correct. The cbo above gets it's data from the
Couples
table.

Any suggestions may save what little hair I have left...
 

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