Hi all,
I have a form in Access which has 3 combo boxes representing the entities accountname, date and report type respectively. The value in these comboboxes is coming from 3 separate tables which are 2 column tables: one for say account name and one for the primary key.
Now according to the chosen combination in the form what happens is that on pressing a command button 'pdf display' a pdf file opens up which is named as 'accountname' + 'reporttype' + 'date'. For eg:
If the user choses Microsoft and Report1 and 10/04/2004 then the report which opens up is named microsoftreport110/04/2004.pdf.
Now i was trying to get this functionality in VBA code (given below). What happens but is that instead of the value stored in cboaccountname, which is the accountname the user has chosen in the combo box, the text cboaccountname itself gets transferred. I tried giving it as &cboaccountname& but of no use. The same is the case with report type and date.
Any ideas !
Private Sub cmddri_Click()
Dim pdflink As String
If IsNull(Cboaccountnamei) Or Cboaccountnamei = "" Then
MsgBox "Select Account Name"
Cboaccountnamei.SetFocus
ElseIf IsNull(cboreporttypei) Or cboreporttypei = "" Then
MsgBox "Select Report Type"
Cboaccountnamei.SetFocus
ElseIf IsNull(cbodatesi) Or cbodatesi = "" Then
MsgBox "Select Date"
Cboaccountnamei.SetFocus
Else
pdflink = "\\lvamfs01\shared\axysreportscreation\" + Cboaccountname.Value + cboreporttype.value + cbodate.value + ".pdf "
Debug.Print pdflink
FollowHyperlink pdflink, , True
End If
End Sub
Cheers
Goels
I have a form in Access which has 3 combo boxes representing the entities accountname, date and report type respectively. The value in these comboboxes is coming from 3 separate tables which are 2 column tables: one for say account name and one for the primary key.
Now according to the chosen combination in the form what happens is that on pressing a command button 'pdf display' a pdf file opens up which is named as 'accountname' + 'reporttype' + 'date'. For eg:
If the user choses Microsoft and Report1 and 10/04/2004 then the report which opens up is named microsoftreport110/04/2004.pdf.
Now i was trying to get this functionality in VBA code (given below). What happens but is that instead of the value stored in cboaccountname, which is the accountname the user has chosen in the combo box, the text cboaccountname itself gets transferred. I tried giving it as &cboaccountname& but of no use. The same is the case with report type and date.
Any ideas !
Private Sub cmddri_Click()
Dim pdflink As String
If IsNull(Cboaccountnamei) Or Cboaccountnamei = "" Then
MsgBox "Select Account Name"
Cboaccountnamei.SetFocus
ElseIf IsNull(cboreporttypei) Or cboreporttypei = "" Then
MsgBox "Select Report Type"
Cboaccountnamei.SetFocus
ElseIf IsNull(cbodatesi) Or cbodatesi = "" Then
MsgBox "Select Date"
Cboaccountnamei.SetFocus
Else
pdflink = "\\lvamfs01\shared\axysreportscreation\" + Cboaccountname.Value + cboreporttype.value + cbodate.value + ".pdf "
Debug.Print pdflink
FollowHyperlink pdflink, , True
End If
End Sub
Cheers
Goels