TxRedRaider
New member
- Local time
- Today, 14:00
- Joined
- Mar 16, 2011
- Messages
- 3
This is driving me insane. I have a batch of code to open up a report. I want that report to be based on a query. ive done this multiple other times in this particular database, but for some reason when i run this particular batch of code it pops up with a box that asking you to put in a value for personaldata.platoon:
this is the busted code:
Private Sub Command3_Click()
Dim strSection As String
Dim edb As DAO.Database
Dim eqdf As DAO.QueryDef
Dim mysql As String
Set edb = CurrentDb
Set eqdf = edb.QueryDefs("NCOERDueDates")
Me.RecordSource = "NCOERDueDates"
Combo1.SetFocus
strSection = Combo1.text
mysql = "SELECT personaldata.*" & _
"FROM personaldata " & _
"WHERE PersonalData.Platoon = '" & strSection & "' ;"
eqdf.SQL = mysql
Set qdf = Nothing
Set db = Nothing
DoCmd.OpenReport "NCOER Due Dates all", acViewReport, "NCOERDueDates", , acDialog
DoCmd.Close acForm, "frmNCOERDueDateQuery"
End Sub
and here is an example of code that works:
Private Sub Command3_Click()
Dim strSection As String
Dim edb As DAO.Database
Dim eqdf As DAO.QueryDef
Dim mysql As String
Set edb = CurrentDb
Set eqdf = edb.QueryDefs("BarracksFilter")
Me.RecordSource = "BarracksFilter"
Combo1.SetFocus
strSection = Combo1.text
mysql = "SELECT personaldata.*" & _
"FROM personaldata " & _
"WHERE personaldata.platoon = '" & strSection & "' AND personaldata.barracks = TRUE;"
eqdf.SQL = mysql
Set qdf = Nothing
Set db = Nothing
DoCmd.OpenReport "Barracks Report All", acViewReport, "BarracksFilter", , acDialog
DoCmd.Close acForm, "frmBarracksQuery"
End Sub
any ideas?
this is the busted code:
Private Sub Command3_Click()
Dim strSection As String
Dim edb As DAO.Database
Dim eqdf As DAO.QueryDef
Dim mysql As String
Set edb = CurrentDb
Set eqdf = edb.QueryDefs("NCOERDueDates")
Me.RecordSource = "NCOERDueDates"
Combo1.SetFocus
strSection = Combo1.text
mysql = "SELECT personaldata.*" & _
"FROM personaldata " & _
"WHERE PersonalData.Platoon = '" & strSection & "' ;"
eqdf.SQL = mysql
Set qdf = Nothing
Set db = Nothing
DoCmd.OpenReport "NCOER Due Dates all", acViewReport, "NCOERDueDates", , acDialog
DoCmd.Close acForm, "frmNCOERDueDateQuery"
End Sub
and here is an example of code that works:
Private Sub Command3_Click()
Dim strSection As String
Dim edb As DAO.Database
Dim eqdf As DAO.QueryDef
Dim mysql As String
Set edb = CurrentDb
Set eqdf = edb.QueryDefs("BarracksFilter")
Me.RecordSource = "BarracksFilter"
Combo1.SetFocus
strSection = Combo1.text
mysql = "SELECT personaldata.*" & _
"FROM personaldata " & _
"WHERE personaldata.platoon = '" & strSection & "' AND personaldata.barracks = TRUE;"
eqdf.SQL = mysql
Set qdf = Nothing
Set db = Nothing
DoCmd.OpenReport "Barracks Report All", acViewReport, "BarracksFilter", , acDialog
DoCmd.Close acForm, "frmBarracksQuery"
End Sub
any ideas?