INSERT INTO værdier fra 2 inpotbokse
Hvorledes skal denne :DoCmd.RunSQL "INSERT INTO ReportPeriod ([CY End]) VALUES ('" & MyValue1 & "');"
se ud hvis jeg vil have indsat data fra 2 inputbokse, jeg synes ikke jeg kan få det til at virke, har b.a. forsøgt med følgende :
DoCmd.RunSQL "INSERT INTO ReportPeriod ([CY End], [PE Count] ) VALUES ('" & MyValue1 & "', '" & MyValue1 & "');"
Public Function Generate_Report()
Dim Message1, Title1, Default1, MyValue1
Dim Message2, Title2, Default2, MyValue2
Message1 = "Input last week end date" ' Set prompt.
Title1 = "Report criteria 1" ' Set title.
Default1 = "01-01-2011" ' Set default.
Message2 = "Input no of days history" ' Set prompt.
Title2 = "Report criteria 2" ' Set title.
Default2 = "7" ' Set default.
MyValue1 = InputBox(Message1, Title1, Default1)
MyValue2 = InputBox(Message2, Title2, Default2)
strSql = "DELETE ReportPeriod.* "
strSql = strSql & "FROM ReportPeriod;"
db.Execute strSql
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO ReportPeriod ([CY End]) VALUES ('" & MyValue1 & "');"
DoCmd.SetWarnings True
End Function
