Pull data from table..

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,232
Hi Experts and all,

I have new and very 1st query on access db.

Table name "Data", contains 4th and 5th column email id's. I want to fetch that in variable. Can any one provide me select query, how to write that..

Many Thanks..
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Use the Query Designer or the Query Wizard in Access. After you are satisfied with he result Open the query in SQL view and copy the query.
if it is to be used in VBA code - replace all " with ' (if any) .
 
Upvote 0
Use the Query Designer or the Query Wizard in Access. After you are satisfied with he result Open the query in SQL view and copy the query.
if it is to be used in VBA code - replace all " with ' (if any) .

Im getting an error on this.. dont understand why?

Code:
Private Sub CreateCon()
Dim pwd As String
Dim stDB As String
pwd = Module2.GivePwd
Set cnt = New ADODB.Connection
stDB = Module2.GivePath
stCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & stDB & ";Jet OLEDB:Database Password=" & pwd
[COLOR=#ff0000]cnt.Open stCon[/COLOR]
End Sub
 
Upvote 0
Can you please provide that select query, it will help great.. Thanks

Use the Query Designer or the Query Wizard in Access. After you are satisfied with he result Open the query in SQL view and copy the query.
if it is to be used in VBA code - replace all " with ' (if any) .
 
Upvote 0
Can you please provide that select query, it will help great.. Thanks
From your original posting, it is not clear to me what your data looks like, and what you are trying to pull out.
How about posting a small sample of your data, and let us know what you want the expected results to look like (based on that example)?
 
Upvote 0
Hi Joe, Hi welshgasman,

Thanks both for your reply. Thanks for older post too..

I simply want select query which will fetch value from access table. This values are placed in "Data" table in col 4 and 5. These col contains email id's. I want this email id in 2 variable..

From your original posting, it is not clear to me what your data looks like, and what you are trying to pull out.
How about posting a small sample of your data, and let us know what you want the expected results to look like (based on that example)?
 
Upvote 0
Here is a link that shows you how to do Select Query with Criteria in Access: https://support.office.com/en-us/ar...-a-query-b00dd711-667e-4bf4-85d0-55da8049ce49
If that does not give you what you want, please do what I asked, and post a small sample of your data, along with your expected results.

In Access, you can simply open a Table or a Query and copy and paste the data here, like this:

ANoAFNameALName
1AdamAnt
2BenButton
3CarrieCarne

<caption> TableA </caption><thead>
</thead><tbody>
</tbody><tfoot></tfoot>
 
Upvote 0
Thanks Joe, for ur valuable time and this explanation.. I'm mentioning my scenario here..

**This is access related requirement.

I do have visual basic 6.0 software with me, where i have designed one of the form. On this form, there is control combo. Combo contains team names in list.

Suppose, employee A got shifted from Team name - US to Team name - UK, then I will click on that command button which is named "Updated Details".

This data will go in Access DB table "Data". This is pretty simple and successfully working.

Reason to ask my question - When I clicked command button which is named "Updated Details", it should also perform one more step of action, i.e. as follows --

"Data" table contains 4th and 5th column, email id's. when i will change team name on combo button, one of the variable should capture old team name and another variable name should capture the new team name which i will select.

When saving this data, e-mail should go on old team name and new team name respective mail id's..

This is what I'm trying to do.. and hence Im trying to capture 4th and 5th column data in variables. Hence asking for select query..
 
Upvote 0
I do have visual basic 6.0 software with me, where i have designed one of the form. On this form, there is control combo. Combo contains team names in list.
Why are you using Visual Basic 6.0 instead of just using the the built-in VBA for Access?
I have no experience interacting Visual Basic with Access (I have never had any reason to, as Access has its own VBA).
 
Upvote 0

Forum statistics

Threads
1,213,517
Messages
6,114,089
Members
448,548
Latest member
harryls

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top