VBA Code Control referencing

Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.Sc
Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.Sc used Ask the Experts™
on
Hi Experts!


Thank you so much for helping me here for too long , I have now done 97%  of REST API and all appear to be working accurately.

Now instead of inserting the ID =  1 or 8 manually in the code, I want to use a  text control otherwise how are the people going to accessing the VBA code in Ms Access runtime?

http.Open "GET", "http://jsonplaceholder.typicode.com/users/?id= 1", False

Open in new window



The above works very well in the VBA code , its just that  it will be difficult to be changing the ID in the code , I want something like below:

http.Open "GET", "http://jsonplaceholder.typicode.com/users/?id = &Me.txtUserID", False

Open in new window


How can it be done to work also like the one below?

http.Open "GET", "http://jsonplaceholder.typicode.com/users/?id= 1", False

Open in new window


I thought this was the easiest, but has proved me wrong again , any idea will be very much appreciated.

Regards

Chris
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
John TsioumprisSoftware & Systems Engineer

Commented:
Just use a string variable to  store the complete link including id and everything and feed this to the

http.Open "GET",YourStringVariable,False
IT / Software Engineering Consultant
Top Expert 2016
Commented:
You have the quotes wrong in your attempt, you can try:

http.Open "GET", "http://jsonplaceholder.typicode.com/users/?id=" & Me.txtUserID, False

Open in new window


»bp
Bill Prew

Thank you so much you have rescued me on this one, I almost gave up.

Regards

Chris
Bill PrewIT / Software Engineering Consultant
Top Expert 2016

Commented:
Great, glad that helped.


»bp
John TsioumprisSoftware & Systems Engineer

Commented:
If you have used the variable assignment as i recommend you would have spot it easier

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start Today