From: Afrosheen via AccessMonster.com on
The code below {sql6} is where I'm having the problem. The code for {sql5}
works in another program I have so I thought I could use the basics of it.

What I need it to do is to clear out [set to null] the field called [super1]
using the txtAssist string.

Your help would be much appreciated.

Dim SQL, txtAssist As String
Dim dtm As ADODB.Connection, sql6 As String
10 txtAssist = cmboSupervisor.Column(3)

'sql5 = "update tbl_roster set location = Null where shift = 'b-days' And Not
(tbl_roster.pp) = true"

20 If SupMan = True Then
30 MsgBox "There should be a check in the box"
40 Else
50 MsgBox "No check in the box"

60 Set dtm = CurrentProject.AccessConnection
70 sql6 = "Update tblMain set super1 = Null where super1 =" &
txtAssist
80 dtm.Execute sql6, adCmdText + adExecuteNoRecords
90 Set dtm = Nothing

100 End If

Thanks for your help.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201001/1

From: Gina Whipp on
Afrosheen,

Try setting it to Flase, NULL may not be allowed.

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

"Afrosheen via AccessMonster.com" <u46942(a)uwe> wrote in message
news:a2d80d9ce7715(a)uwe...
The code below {sql6} is where I'm having the problem. The code for {sql5}
works in another program I have so I thought I could use the basics of it.

What I need it to do is to clear out [set to null] the field called [super1]
using the txtAssist string.

Your help would be much appreciated.

Dim SQL, txtAssist As String
Dim dtm As ADODB.Connection, sql6 As String
10 txtAssist = cmboSupervisor.Column(3)

'sql5 = "update tbl_roster set location = Null where shift = 'b-days' And
Not
(tbl_roster.pp) = true"

20 If SupMan = True Then
30 MsgBox "There should be a check in the box"
40 Else
50 MsgBox "No check in the box"

60 Set dtm = CurrentProject.AccessConnection
70 sql6 = "Update tblMain set super1 = Null where super1 =" &
txtAssist
80 dtm.Execute sql6, adCmdText + adExecuteNoRecords
90 Set dtm = Nothing

100 End If

Thanks for your help.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201001/1


From: Gina Whipp on
Oops, typo... that would False

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

"Gina Whipp" <NotInterested(a)InViruses.com> wrote in message
news:u0joPPRoKHA.1548(a)TK2MSFTNGP04.phx.gbl...
Afrosheen,

Try setting it to Flase, NULL may not be allowed.

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

"Afrosheen via AccessMonster.com" <u46942(a)uwe> wrote in message
news:a2d80d9ce7715(a)uwe...
The code below {sql6} is where I'm having the problem. The code for {sql5}
works in another program I have so I thought I could use the basics of it.

What I need it to do is to clear out [set to null] the field called [super1]
using the txtAssist string.

Your help would be much appreciated.

Dim SQL, txtAssist As String
Dim dtm As ADODB.Connection, sql6 As String
10 txtAssist = cmboSupervisor.Column(3)

'sql5 = "update tbl_roster set location = Null where shift = 'b-days' And
Not
(tbl_roster.pp) = true"

20 If SupMan = True Then
30 MsgBox "There should be a check in the box"
40 Else
50 MsgBox "No check in the box"

60 Set dtm = CurrentProject.AccessConnection
70 sql6 = "Update tblMain set super1 = Null where super1 =" &
txtAssist
80 dtm.Execute sql6, adCmdText + adExecuteNoRecords
90 Set dtm = Nothing

100 End If

Thanks for your help.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201001/1



From: Douglas J. Steele on
If super1 is a Text field, you need quotes around the value:

sql6 = "Update tblMain set super1 = Null where super1 =""" & txtAssist &
""""

I'm assuming super1 is someone's name, so I'm trying to accomodate the
possibility of an apostrophe in the name. That's the reason for three double
quotes in a row before txtAssist and four double quotes in a row afterwards.


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Afrosheen via AccessMonster.com" <u46942(a)uwe> wrote in message
news:a2d80d9ce7715(a)uwe...
> The code below {sql6} is where I'm having the problem. The code for {sql5}
> works in another program I have so I thought I could use the basics of it.
>
> What I need it to do is to clear out [set to null] the field called
> [super1]
> using the txtAssist string.
>
> Your help would be much appreciated.
>
> Dim SQL, txtAssist As String
> Dim dtm As ADODB.Connection, sql6 As String
> 10 txtAssist = cmboSupervisor.Column(3)
>
> 'sql5 = "update tbl_roster set location = Null where shift = 'b-days' And
> Not
> (tbl_roster.pp) = true"
>
> 20 If SupMan = True Then
> 30 MsgBox "There should be a check in the box"
> 40 Else
> 50 MsgBox "No check in the box"
>
> 60 Set dtm = CurrentProject.AccessConnection
> 70 sql6 = "Update tblMain set super1 = Null where super1 =" &
> txtAssist
> 80 dtm.Execute sql6, adCmdText + adExecuteNoRecords
> 90 Set dtm = Nothing
>
> 100 End If
>
> Thanks for your help.
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201001/1
>


From: Afrosheen via AccessMonster.com on
Thanks for the reply Gina and Doug. It is a true/false question.

I appreciate the help. I really do.

Thanks again.

Douglas J. Steele wrote:
>If super1 is a Text field, you need quotes around the value:
>
>sql6 = "Update tblMain set super1 = Null where super1 =""" & txtAssist &
>""""
>
>I'm assuming super1 is someone's name, so I'm trying to accomodate the
>possibility of an apostrophe in the name. That's the reason for three double
>quotes in a row before txtAssist and four double quotes in a row afterwards.
>
>> The code below {sql6} is where I'm having the problem. The code for {sql5}
>> works in another program I have so I thought I could use the basics of it.
>[quoted text clipped - 27 lines]
>>
>> Thanks for your help.

--
Message posted via http://www.accessmonster.com