I got help yesterday with a problem and got help working it out or so I thought, heres whats happening
OK here it is the code, test this and tell me why it won't work it makes no sense. Basically this is executed on a button click from a form and the values serviceno and start are normally taken from a listbox but for testing purposes heres already set numbers.
within this Access database includes a table called -
table - Timesheet Header
and it has three fields
field datatype
Flag yes/No
SERVICE_COMPANY_NO text
PERIOD_STARTING Date/Time
It includes this data
flag SERVICE_COMPANY_NO PERIOD_STARTING
FALSE 0989 11/09/99
FALSE 7865 02/02/98
FALSE 4555 09/08/01
form - frmflag set an onclick event and use following code:
Dim serviceno As String
Dim start As Date
serviceno = "7865"
start = "02/02/98"
DoCmd.RunSQL "UPDATE [Timesheet Header] SET Flag = True " & _
"WHERE SERVICE_COMPANY_NO='" & serviceno & "' " & _
"AND PERIOD_STARTING = #" & start & "#;"
basically this SQL statement is supposed to update my field flag to true where service_company_no = variable serviceno set in code declaration and period_starting = start set in code.
OK heres everything you need to replicate my access database as it is, yeah It will work but only with the one value set serviceno = "7865" and
start = "02/02/98" the one that is initally set. try changing the values in the code to other record values from the table and see if it works it don't why I don't know.
please help me understand this somebody I've tried fer hours ; )
and I'll include an attached example press on both toggle buttons called select visible only and turn flag on buttons and then press OK to get form to perform code. on the frmform
OK here it is the code, test this and tell me why it won't work it makes no sense. Basically this is executed on a button click from a form and the values serviceno and start are normally taken from a listbox but for testing purposes heres already set numbers.
within this Access database includes a table called -
table - Timesheet Header
and it has three fields
field datatype
Flag yes/No
SERVICE_COMPANY_NO text
PERIOD_STARTING Date/Time
It includes this data
flag SERVICE_COMPANY_NO PERIOD_STARTING
FALSE 0989 11/09/99
FALSE 7865 02/02/98
FALSE 4555 09/08/01
form - frmflag set an onclick event and use following code:
Dim serviceno As String
Dim start As Date
serviceno = "7865"
start = "02/02/98"
DoCmd.RunSQL "UPDATE [Timesheet Header] SET Flag = True " & _
"WHERE SERVICE_COMPANY_NO='" & serviceno & "' " & _
"AND PERIOD_STARTING = #" & start & "#;"
basically this SQL statement is supposed to update my field flag to true where service_company_no = variable serviceno set in code declaration and period_starting = start set in code.
OK heres everything you need to replicate my access database as it is, yeah It will work but only with the one value set serviceno = "7865" and
start = "02/02/98" the one that is initally set. try changing the values in the code to other record values from the table and see if it works it don't why I don't know.
please help me understand this somebody I've tried fer hours ; )
and I'll include an attached example press on both toggle buttons called select visible only and turn flag on buttons and then press OK to get form to perform code. on the frmform
Last edited: