Pull data from table..

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,130
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..
 

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

bobsan42

Well-known Member
Joined
Jul 14, 2010
Messages
1,343
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) .
 

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,130
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
 

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,130
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) .
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
54,432
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

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)?
 

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,130

ADVERTISEMENT

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)?
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
54,432
Office Version
  1. 365
Platform
  1. Windows
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>
 

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,130
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..
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
54,432
Office Version
  1. 365
Platform
  1. Windows
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).
 

Watch MrExcel Video

Forum statistics

Threads
1,108,626
Messages
5,523,981
Members
409,550
Latest member
baaabies

This Week's Hot Topics

Top