Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

VB Question - ouput file from MS Access


  • Please log in to reply

#1
gopherjpmp

gopherjpmp

    New Member

  • Member
  • Pip
  • 4 posts
I am not a programmer, but can figure out enough to hurt myself...

I am trying to out put some files I run through access into a folder on our network drive. The problem is all the users have the drive as a different letter (too big of company to be able to change that!)


The Access mdb pulls information from a ODBC and does its thing. Before they click the button to do all of this, I created a combo box (drop down) that has a-z to choose their drive letter...

Here is the code past that which I am trying to have spit out the info..

_______________
Dim strdrvltr As String




Public Sub Combo14_Change()

Set strdrvltr = Combo14.Value

End Sub

Sub deleteme()




DoCmd.OutputTo acOutputTable, "22+ Red Tab", acFormatXLS, strdrvltr & ":\engquasn\patterson\inspection inventory\data\22+.xls", False


End Sub
__________________

it comes back saying "UCO Data can't save the output data to the file you've selected.

I am positive it has to do with my string in there?

any help would be great as right now I have to creat a different macro for every drive letter known in the department to output the files =\
  • 0

Advertisements


#2
Hai Mac

Hai Mac

    Member

  • Member
  • PipPipPip
  • 260 posts
Wow, I am sorry, I quite didn't understand exactly what you wrote, but sure I can see one error.

strdvltr is a string and you don't use Set to store a value into it, so just strdrvltr= Combo14.Value is enough (what's more, give your controls more appropriate names, it helps alot :whistling:)

That's all I can advise right now.
  • 0

#3
gopherjpmp

gopherjpmp

    New Member

  • Topic Starter
  • Member
  • Pip
  • 4 posts
Normally I do give proper names, I just tried this really quick. Normally I will go back and rename when finished.

What I am trying to do is have a combo box available on an Access form that will allow a user to choose a-z and store that value as strdrvltr (string drive letter).

After that is stored, they will click a button to run various queries to d/l and modify the data and then spit it out to a directory on our shared drive where an excel spreadsheet will further modify the info.

The problem is I get an error on this line of code:
DoCmd.OutputTo acOutputTable, "22+ Red Tab", acFormatXLS, strdrvltr & ":\engquasn\patterson\inspection inventory\data\22+.xls", False

The error is
UCO Data can't save the output data to the file you've selected.

Like I mentioned, I know very little programming as I haven't done any since college (7 yrs ago) and I mainly set-up simple databases to save time.

I did remove the set command, thanks for that :whistling: now if I could just get the rest figured out
  • 0

#4
stu_design

stu_design

    Member

  • Member
  • PipPipPip
  • 217 posts

The problem is I get an error on this line of code:
DoCmd.OutputTo acOutputTable, "22+ Red Tab", acFormatXLS, strdrvltr & ":\engquasn\patterson\inspection inventory\data\22+.xls", False


umm sometimes they dont like for you to use spaces when saving (shouldnt matter) sometimes it does .... and also 22+.xls ---sometmes they dont like extra symbols as a plus (shouldnt matter) but ....
u are using VBE or just normal vb?
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP