We help IT Professionals succeed at work.

edit a record using a  date variable in the sql statement

Fordraiders
Fordraiders asked
on
35 Views
Last Modified: 2016-02-11
access 2010  vba

in code prior to trying to do this..

I have a table linked via sql server   "dbo_t_nsc_trackcode_trans_time_entry"
in this table i have a value for lookup. [opened_at]  a date field


I'm trying to update a record in this table above.
In the sql string  
g =  date

Global g As Date
d = now()
Forms!NSC_DataEntry.txtReOpened = d
g = Forms!NSC_DataEntry.txtReOpened  





If m = True Then
           Dim db1 As DAO.Database
           Dim rst1 As DAO.Recordset
           Dim strSQL1 As String
           Set db1 = CurrentDb()
           strSQL1 = "SELECT [nsc_id_ref], [opened_at], [InProgress_or_closed_at] FROM [dbo_t_nsc_trackcode_trans_time_entry] where [opened_at] = '" & g & "' "
           Set rst1 = db1.OpenRecordset(strSQL1, dbOpenDynaset)
          ' Dim q As DAO.Recordset
          ' Set q = CurrentDb.OpenRecordset("SELECT * FROM [dbo_t_nsc_trackcode_trans_time_entry] where [opened_at] = '" & g & "'", dbOpenDynaset, dbSeeChanges)
           rs1.Edit
           rs1![InProgress_or_Closed_at] = Now()
           Forms!NSC_DataEntry.txtReOpened = ""
         End If

Open in new window

Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks sorry for the delay
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
You are welcome!

/gustav
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.