Hi @Gasman , my system runs on windows 7, while trying to update service packs, am told windows 7 support is over(this I am aware of), and advised to update to another windows version. At least on this system, i want to retain windows 7.
Hi @Gasman , my system runs on windows 7, while trying to update service packs, am told windows 7 support is over(this I am aware of), and advised to update to another windows version. At least on this system, i want to retain windows 7.
The latest if 4 holds all previous. I only have sp3 as you can see?
According to Google, sp3 is the latest for 2007, so no idea what you are looking at?
The images are what I demoes showing how you can format a continuous form and code to make it act bound. That was separate from the default choice discussion.
You should have a PK in the search results somewhere. I used the vesselname since there was none.
Code:
Private Sub frmbutPrintSelected_Click()
DoCmd.ShowToolbar "ribbon", acToolbarYes
DoCmd.OpenReport "rptVessel", acViewPreview, , "strVesselName = '" & Me.ctrSearchResults & "'"
DoCmd.Maximize
End Sub
if you had a numeric PK it would be like
DoCmd.OpenReport "rptVessel", acViewPreview, , "SomePKFieldInReport = " & Me.ctrSearchResults
without single quotes.
You can bind the search form to a hidden field if that is the PK.
Thanks for the code...........my PK is the vesselname, I tried the code but on the print priview its just showing the selected record (1 record) instead of what the results on the search.
Private Sub frmbutPrintSelected_Click()
DoCmd.ShowToolbar "ribbon", acToolbarYes
Dim strSql As String
Dim i As Integer
Dim rs As DAO.Recordset
Set rs = Me.ctrSearchResults.Recordset
Do While Not rs.EOF
If strSql = "" Then
strSql = "'" & rs!strVesselName & "'"
Else
strSql = strSql & ", '" & rs!strVesselName & "'"
End If
rs.MoveNext
Loop
If Not strSql = "" Then
strSql = "strVesselName in (" & strSql & ")"
MsgBox strSql
DoCmd.OpenReport "rptVessel", acViewPreview, , strSql
DoCmd.Maximize
End If
End Sub
I would change this to a multiselect listbox, then you can filter but only pick ones you want to print.
Private Sub frmbutPrintSelected_Click()
DoCmd.ShowToolbar "ribbon", acToolbarYes
Dim strSql As String
Dim i As Integer
Dim rs As DAO.Recordset
Set rs = Me.ctrSearchResults.Recordset
Do While Not rs.EOF
If strSql = "" Then
strSql = "'" & rs!strVesselName & "'"
Else
strSql = strSql & ", '" & rs!strVesselName & "'"
End If
rs.MoveNext
Loop
If Not strSql = "" Then
strSql = "strVesselName in (" & strSql & ")"
MsgBox strSql
DoCmd.OpenReport "rptVessel", acViewPreview, , strSql
DoCmd.Maximize
End If
End Sub
I would change this to a multiselect listbox, then you can filter but only pick ones you want to print.
Thanks for the response... I tried the code, opened the form and try to search for "en" and this message pops up
after I clicked "Ok" it brings me to the print preview of the search result
after I close the print preview I tried to make another search and click the "Print Selected" button again but this time nothing happens, the button stopped working....
what should I do so that the pop up message wont show.... and so that "Print Selected" button will still work on the succeeding searches
Thanks but I cant find the line of code to delete...... I tried do delete some code but it messed the process.... and what should I change so that the "Print Selected" button will work on succeeding searches
Public Sub FilterReport()
DoCmd.ShowToolbar "ribbon", acToolbarYes
Dim strSql As String
Dim i As Integer
For i = 1 To Me.ctrSearchResults.ListCount - 1
If strSql = "" Then
strSql = "'" & Me.ctrSearchResults.ItemData(i) & "'"
Else
strSql = strSql & ", '" & Me.ctrSearchResults.ItemData(i) & "'"
End If
Next i
If Not strSql = "" Then
strSql = "strVesselName in (" & strSql & ")"
'MsgBox strSql
DoCmd.OpenReport "rptVessel", acViewPreview, , strSql
DoCmd.Maximize
End If
End Sub
However. This database is probably corrupt. Make a brand new one. Then import all your tables first. Compact and repair. Then import everything else.
It would not throw any errors. So if you wrote some bad code, it just would not run. No runtime errors happened, no message. It would not catch them on compiling either. That is why it seemed as if it was not running, when in fact it should have thrown an error.