VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Calls print-out options

by Louis Molnar (1 Submission)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 12th January 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Calls print-out options

API Declarations


Name of form name and source parameters needed

Rate Calls print-out options



On Error GoTo ErrHandler
  Dim strSQL As String
  Dim strQryName As String
  Dim strMsg As String

  strQryName = "[form to be printed]"
  strMsg = "Your query has been successfully printed."
  strSQL = Nz(Me.txtSQL2.Value, "000") [will have to be adapted]

  If strSQL <> "000" And strSQL <> "" Then
    'If user enters a string, finish processing
    

'Open target file
DoCmd.OpenForm "[form to be printed]" 
'Run print dialogue
DoCmd.RunCommand acCmdPrint 
DoCmd.Close 'close file
    
    Me.RecordSource = strSQL

  Else
    'No input, alert user & reset focus
    
    strMsg = "Please make sure that all parameters are defined."
    Me.txtSQL.Undo
  End If

  MsgBox strMsg
'Show confirmation message whether failed or successful

ExitHere:
  Exit Sub

ErrHandler:
  MsgBox Err.Description
  Resume ExitHere
End Sub

Download this snippet    Add to My Saved Code

Calls print-out options Comments

No comments have been posted about Calls print-out options. Why not be the first to post a comment about Calls print-out options.

Post your comment

Subject:
Message:
0/1000 characters