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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

checking a value in an access table 2

Status
Not open for further replies.

scrano

Technical User
Jan 24, 2001
51
AU
Can anyone please tell me how to look up a value from a field within an access table, I know how to make a connection to the database I want to work with but I'm not real sure how to look up a value in a table and store the string in a variable, also is it possible to check and see if a particular text file exists on my hard drive with VB, any help would be greatly appreciated, thanx in advance
 
Are you using ADO?

Check out the Dir command in vb. You can use it to find a directory or a file on your hard drive.
RKA:)
 
Yeah I am using ADO but I'm not real sure on what I'm doing, I'm a bit of a novice with VB and am just trying to alter some code I've alredy got to get it to do what I want but I can't seem to make it work
 
Hi scrano,

To Look Up A Field:


strSQL = "Select Field From Table Where Field = " & Variable

rs.open strSQL,yourConn
if not rs.eof then
txtTextBox.Text=rs.fields(0)
end if
rs.close

'for clarity: rs is an ADODB.Recordset
'and youConn is the database connection


To See If A File Exists

reference the Microsoft Scripting Runtime


dim fso as new FileSystemObject

if fso.FileExists("Dir\YourFile.ext") then
msgbox "It exists"
end if


Ciao >:):O>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top