C
C0rrinn3
I am very new to Access and VB and I am trying update production dates in a
table and keep getting an error saying that an action query cannot be used as
a row source. Here is the code i used. Debug always stops on the Do.Cmd
Option Compare Database
Dim strSQL As String
Dim recs As Long
Dim NewDate As Variant
Dim CurrDate As Variant
Dim db As DAO.Database
Private Sub cmbImpl_Click()
cmbImpl.Requery
End Sub
Private Sub cmbImpl_Enter()
cmbImpl.Requery
End Sub
Private Sub cmbImpl_GotFocus()
Me.Requery
End Sub
Private Sub cmdCancel_Click()
DoCmd.Close
End Sub
Private Sub Command60_Click()
'On Error GoTo Err_Command60_Click
Set db = CurrentDb
Set cnn = CurrentProject.Connection
Set rst = New ADODB.Recordset
txtCurrDate.Requery
txtReqDate.Requery
NewDate = txtReqDate
CurrDate = txtCurrDate
strSQL = "UPDATE qry_Rel_Date_Change SET qry_Rel_Date_Change.PROD_DATE =
NewDate WHERE qry_Rel_Date_Change.PROD_DATE = txtCurrDate"
DoCmd.SetWarnings (WarningsOff)
DoCmd.RunSQL strSQL
DoCmd.SetWarnings (warningson)
MsgBox Prompt:="Updates applied ", Buttons:=vbOKOnly + vbExclamation
Exit_Command60_Click:
Exit Sub
Err_Command60_Click:
MsgBox Err.Description
Resume Exit_Command60_Click
End Sub
table and keep getting an error saying that an action query cannot be used as
a row source. Here is the code i used. Debug always stops on the Do.Cmd
Option Compare Database
Dim strSQL As String
Dim recs As Long
Dim NewDate As Variant
Dim CurrDate As Variant
Dim db As DAO.Database
Private Sub cmbImpl_Click()
cmbImpl.Requery
End Sub
Private Sub cmbImpl_Enter()
cmbImpl.Requery
End Sub
Private Sub cmbImpl_GotFocus()
Me.Requery
End Sub
Private Sub cmdCancel_Click()
DoCmd.Close
End Sub
Private Sub Command60_Click()
'On Error GoTo Err_Command60_Click
Set db = CurrentDb
Set cnn = CurrentProject.Connection
Set rst = New ADODB.Recordset
txtCurrDate.Requery
txtReqDate.Requery
NewDate = txtReqDate
CurrDate = txtCurrDate
strSQL = "UPDATE qry_Rel_Date_Change SET qry_Rel_Date_Change.PROD_DATE =
NewDate WHERE qry_Rel_Date_Change.PROD_DATE = txtCurrDate"
DoCmd.SetWarnings (WarningsOff)
DoCmd.RunSQL strSQL
DoCmd.SetWarnings (warningson)
MsgBox Prompt:="Updates applied ", Buttons:=vbOKOnly + vbExclamation
Exit_Command60_Click:
Exit Sub
Err_Command60_Click:
MsgBox Err.Description
Resume Exit_Command60_Click
End Sub