Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MSAccess and VBA 1

Status
Not open for further replies.

Noobie2002

Technical User
Mar 29, 2011
8
US
Hi,

Having some trouble here. Basically I will be taking an input from the user. If that input begins with numerically run "This" query and if it begins alphanumberic run "That" query. And I want the result to display a picture. Need help. I've found bits and pieces about parsing, but I think I'm missing some parts. Thanks!
 
if IsNumeric(left(userinput,1)) then
docmd.openquery "this"
else
docmd.openquery "That"


end if
 
Thanks...

I don't need to specify the parsed information to run the query on? This is what I have

[Sub Using_InputBox_Method()
Dim CI As String
Dim GP As String
Dim SP As String

'Scan for input, parse, and run query

CI = InputBox("Ready for Scan", "Scan Prompt") 'Set prompt

If CI Like "PO#*" Then
GP = Right(CI, 8)
DoCmd.OpenQuery ("Gam/UV Query")
DoCmd.OpenQuery ("UV Query")

Else: SP = Left(CI, 12)
DoCmd.OpenQuery ("UV Query")

End If

End Sub
 
The code is debugged according to VB. Just not comfortable with VB and was wondering if I was doing this right.
 
I want the parameter for the queries to be the parsed information.
 
i dont know what you want to achive the code you supplied does not have anything todo whit what qurey to run if numaric or not

give some examples of input and what qurey to run
 
input would be for example a string: 12345678901AB000123456789 or PO#1234567&ABC01234. If it is the first it would search 12345678901A on one table and display appropriate drawing. If it is the second it would search ABC01234 on the second table to get a 09876543210B. Using the 09876543210B from the first table to display the appropriate drawing.
 
... or could i just skip the first query altogether and just do
Application.FollowHyperlink "C:\PDF_name.pdf" where pdf_name would be 12345678901A? And more or less the same with the PO#... except I need to do a query to get the corresponding number to reference for the followhyperlink?

Can I do this?

 
Thanks so much for your help!

Now I'm getting a Runtime error '490' on the followhyperlink?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top