cracked it.
I had to create some queryDefs in order to use in the output to excel command.
so...
Set Qd1 = CurrentDb.CreateQueryDef("DamagedByCourier", "select * from Qry_Claims_Damaged_by_Courier where courier = '" & courier & "'")
...then...
'output to sheet1...
Thanks Ken.
This works fine...
'output to sheet1
DoCmd.OutputTo acOutputQuery, "Qry_Claims_Damaged_by_Courier", acFormatXLS, pth
....which is ok if you've set the criteria in the query already but i'm trying to pass some criteria so i can loop through and create different reports.
so what...
Hey all,
Ok, i'm trying to output some queries to an excel file. I need to pass some criteria. I'm hoping to only use one query and not have to duplicate them all for each instance.
Here's what i'm trying....
'output to sheet1
sql = "select * from Qry_Claims_Damaged_by_Courier " & _...
Hey baldy...
it's a big ol db. i can make a smal version of it with some sample data.
i had made a mistake before, it should be...
Courier Depot: Mid([Depot],InStr(1,[Depot],"-"),20)
..but i don;t think access like the instr() function being in the mid() function. When i take it out and...
Thanks again.
I'm still getting the same message with...
Courier Depot: IIf([courier]="City Link",[courier],Mid([courier],InStr(1,[courier],"-"),20))
????
when i just use Courier Depot: InStr(1,[Courier],"-")
i get 0's in every cell??
Thanks baldy...
i have tried this but i can't seem to get it to work. i keep getting an ivalid procedure call error...
courier: IIf([courier]="City Link", [courier], Mid([courier],InStr(1,"-"),20))
where am i going wrong??
Thanks.
Hi All,
I'm trying to get the right hand part of a text string so i am only left with the depot name.
Here's how i get them...
49 - Manchester
51/CVT - Nuneaton
58/TEJ - Teeside
8 - Park Royal
Here's what i'd like...
Manchester
Nuneaton
Teeside
Park Royal
Can anyone help with a statement in...
Hey All,
Not sure where to begin with this so i'll start with the basic and hopefully someone will know what i'm talking about.
I have a form that the user will click a button on. The button triggers an import from a lotus notes db.
problem is that when the import is finished the form and...
I tried the SQL route and still get the same error. If i run the code and there is an empty table created as a result then the first time it runs i get a blank listbox, as expected. but if i run it a second time i get the error message 3211 again.
it says that it is locked or in use. is there...
Hi All,
I am trying to create report with a subreport embedded in it. When i run the subreport on it's own it's fine. 1 page (or however many it takes to display the records).
However, when i embed it into another report it duplicates each record so that i have ,say, 88 pages if there are 88...
Hey Crake,
Thanks for your help on this. Still doing the same thing unfortunately. Every time the filter creates an empty table i get the error.
Sigh* i'll come back to it when my patience has repaired itself. :confused:
Ok,
here's my check if table exists function...
Function TableExists(TableName As String) As Boolean
Dim strTableNameCheck
On Error GoTo ErrorCode
'try to assign tablename value
strTableNameCheck = CurrentDb.TableDefs(TableName)
'If no error and we get to this line, true
TableExists =...
Thanks crake.
so i've created a mod with your function but how/where do i call it in my example, how do i examine my existing function (tableExists)?? does it clear my tabledefs?? apologies if i'm not seeing the obvious.
Ta.
Thanks for your reply.
I understand what your saying and clearly it makes sense for access to do that incase you delete by accident.
I'm new to the whole tabledef thing so can you adivise me where i'm setting it to nothing??? Do i need to create a variable to hold my table def in??
'PT2...
Hi All,
I am having problems filtering a list box contents.
I have 5 combo boxes to filter down the list box contents. There are some make table queries and delete table actions going on when the filter is applied.
Problem is is that when i filter the list and there are no results to show i...
Hi,
I have a list box with four cols set by a query. The col widths are...
0cm;0cm;0cm;15cm
..thing is, when the text is longer than the listbox width i get no scroll bar to view the rest of the row.
Any ideas???
Many Thanks.
Me again...
I've been looking on the forums for a way in which to get the last id in a table using sql statements in vba but i'm not sure what i should be looking for.
I first add the new entry to a table. I then want to grab that exact number and use it in an update query.
is there a...