I have an older database I am working with. Need some help.
I have a function that creates a .SNP and opens a new email message and fills out the To and CC and attaches an attachment.
No matter where I try to debug it jumps straight to this. It keeps stopping at
Usually it will let me debug, but not in this instance.
I've checked the path and the permissions look fine on that particular folder. I just keep getting ByRef argument type mismatch on that outFileName. Ideas? - Private Sub Command14_Click()
-
Dim FDest As String
-
Dim SnapshotFile As String
-
Dim ContNum As String
-
Dim ContName As String
-
Dim AuthNumber As String
-
Dim AuthDate As String
-
Dim CrewAuthName As String
-
Dim outFileName() As String
-
End Sub
-
-
If Company.Value = 1 Or Company.Value = 1 Then
-
ReDim Preserve outFileName(0)
-
outFileName(0) = "C:\Temp\" & ContractorName.Value & " Crew Authorization " & cmbContractID.Column(1, cmbContractID.ListIndex) & "-" & AuthNum.Value & " (" & Forms!frmCrewAuthorization!NAME.Value & "'s Crew).snp"
-
-
DoCmd.OutputTo acOutputReport, "rptCrewAuthorization", acFormatSNP, outFileName(0), False
-
GenerateEmail "anoble@*******.com", ContractorName.Value & " Crew Authorization " & cmbContractID.Column(1, cmbContractID.ListIndex) & "-" & AuthNum.Value & " - Starting " & Forms!frmCrewAuthorization!AuthDate.Value, Forms!frmCrewAuthorization!NAME.Value & "'s Crew" & vbCrLf & vbCrLf, outFileName, False
-
End If
-
Why are you using an array when you only have one slot in the array? Is the error on line 13, 14, or 16?
4 1159
Why are you using an array when you only have one slot in the array? Is the error on line 13, 14, or 16?
Line 17 is where the error is.
I have a long lengthy list of If statements that keep going for misc companies.
You bring a good point. I updated some lines.
Now I don't get that error anymore! Thanks for the help! - outFileName = "K:\Anoble\Authorizations\" & ContractorName.Value & " Crew Authorization " & cmbContractID.Column(1, cmbContractID.ListIndex) & "-" & AuthNum.Value & " (" & Forms!frmCrewAuthorization!Name.Value & "'s Crew).snp"
-
DoCmd.OutputTo acOutputReport, "rptCrewAuthorization", acFormatSNP, outFileName, False
-
GenerateEmail "anoble@*****.com", ContractorName.Value & " Crew Authorization " & cmbContractID.Column(1, cmbContractID.ListIndex) & "-" & AuthNum.Value & " - Starting " & Forms!frmCrewAuthorization!AuthDate.Value, Forms!frmCrewAuthorization!Name.Value & "'s Crew" & vbCrLf & vbCrLf, outFileName, False
-
The reason is that in line 17, you passed it the whole array, instead of outFileName(0). So it would have probably worked even using the array if you had specified which "slot" of the array to use.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Chicken Kebab Abdullah |
last post by:
Does anyone know why I get the error 3464 Data type mismatch from the
following code.
I have a form with a combo(to choose a consumable) and 2 list boxes on
it.
list on left is all printers...
|
by: Richard Hollenbeck |
last post by:
I have two functions (one using the other) where I want to pass into it the
character A, B, C, D, or F and have it return a Double
indicating the minimum score it takes to get that grade. For...
|
by: mjoytan |
last post by:
In my real estate access database, I'm trying to create a report that will give me all the properties that are due for a lease renewal this year.
I've been able to use datediff to tell me how...
|
by: daniel.hedz |
last post by:
I am generating a usercontrol dynamically successfully, but when I try
to find that usercontrol I get a type mismatch. This is what I am
doing:
//Loading my usercontrol...
|
by: tiiim |
last post by:
hi all
i created two textboxes to insert date and a button..i hv this following code for that button..but when i ran error msg shows error like 'runtime error 13' & type mismatch..i hv no idea...
|
by: blakerrr |
last post by:
Hi everyone,
I am trying to export a table to an excel file using vba on a form's button click event. I am getting the error:
Compile error: User-defined type not defined.
And it highlights...
|
by: forrestgump |
last post by:
I am currently trying to use the below VBA to import information into excel from access. This VBA is in the excle sheet:-
Public Sub getrs()
Dim adoconn As ADODB.Connection
Dim adors As...
|
by: travjbad1 |
last post by:
I am new to the forum and new to Access, so please be simple and descriptive if possible. I am having a problem with a button on a form that saves, opens a report in pdf, and emails the report to the...
|
by: usharani K |
last post by:
Urgent Help !!!!!!!!!!!while compiling the code I am getting the compile error:
Compile error: User-defined type not defined in form_load.
----------------------------
Private Sub Form_Load()
...
|
by: Shelley Burke |
last post by:
Many thanks for the coding provided in an earlier thread to be able to snapshot document, save as pdf and email it.
Unfort I have done everything as instructed and am still having problems.
...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |