SQL Popup in Access

ludakrishna420

Registered User.
Local time
Yesterday, 23:00
Joined
Aug 22, 2007
Messages
13
The following is the Code i have in Access in SQL. I've just started to learn it and wanted to see if anyone could help. All of the code works to perfection like it should. however, i wanted to know if it was possible to have a Code which would ask for two numbers in the beginning and would replace them in the SQL Code. For example, it would say, "company 1=" and you enter "abc". I want to know this because i wanted to know if there was a way to change the C123 and C145 to anything we want by having a popup in the beginning. You know have it be C*** and have that star replaced to 123 or 234 if you just enter it in the popup in the beginning.

SELECT [C123_Data_Linked]![Item] AS Expr3, C123_Data_Linked.SearchKey2, C123_Data_Linked.Whse, C123_Data_Linked.Code, Min(C123_Forecast_Linked.ForecastDate) AS ForecastDate, C123_Data_Linked.Planner, C456_Data_Linked.RoutingGrp, C456_Data_Linked.NonCritColt, C456_Data_Linked.Code, C456_Cost_Linked.SalesPrice, IIf(IsNull([C456_Data_Linked]![PlannerName]),......
 
If you set up an input box and use the variable name from the input box you can replace it.

I.e.:
Code:
dim inpCompany as string
dim SQL as string
inpCompany = inputbox ("Which company is it?")

SQL = "SELECT (extra stuff) C" & inpcompany & "_DATA_LINKED.SEARCH (the rest);"

That should work. Granted you're going to want to expand upon that.


You didn't say if you found the SQL stuff from a query or not. Are you using a module or VBA code or did you find it from the Access Query SQL Designer?
 

Users who are viewing this thread

Back
Top Bottom