473,467 Members | 1,575 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

have a value from access table

1 New Member
hi

I want to have a value for my table in access database which name Biomed

I use this code

Public Sub test9()
Dim orst As DAO.Recordset
Dim odb As DAO.Database

Dim i As Integer
Set odb = CurrentDb
Set orst = odb.OpenRecordset("select * from biomed where biomedtab = NC5+1159", dbOpenDynaset)



For i = 0 To orst.Fields.Count - 1
MsgBox orst.Fields(i).Value
Next i

orst.Close

odb.Close
Set orst = Nothing
Set odb = Nothing
End Sub

but a have a message error in line set orst and message error is error "3061"

can everbody help me , please?

thanks
Aug 23 '07 #1
1 1274
Stwange
126 Recognized Expert New Member
hi

I want to have a value for my table in access database which name Biomed

I use this code

Public Sub test9()
Dim orst As DAO.Recordset
Dim odb As DAO.Database

Dim i As Integer
Set odb = CurrentDb
Set orst = odb.OpenRecordset("select * from biomed where biomedtab = NC5+1159", dbOpenDynaset)



For i = 0 To orst.Fields.Count - 1
MsgBox orst.Fields(i).Value
Next i

orst.Close

odb.Close
Set orst = Nothing
Set odb = Nothing
End Sub

but a have a message error in line set orst and message error is error "3061"

can everbody help me , please?

thanks
you need to put the parameter in either single or double quote marks if it isn't a number, and SQL statements should end with a semicolon, so:

Set orst = odb.OpenRecordset("SELECT * FROM biomed WHERE biomedtab = 'NC5+1159'; ", dbOpenDynaset)
Aug 23 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: MLH | last post by:
I've followed the instructions found on Microsoft's site... http://support.microsoft.com/default.aspx?scid=kb;en-us;149119&Product=acc97 Here are those instructions... To play and record...
6
by: Danny Lesandrini | last post by:
I'm using an Access database to drive a web site and the colors of various table backgrounds are stored in Access. I want users of the Access database to be able to select colors for the site, but...
8
by: Gompie | last post by:
Why does the function DMin("Abs(!- #" & & "#)";"SomeTable") not work properly with datefields. It always finds the closest difference with a later date only, if an earlier date in the table is...
2
by: MLH | last post by:
Gentlemen: I have declared an array Dim MyTables(14) AS Long Now I want to assign values for MyTables(0) - MyTables(14) equal to the number of records in each table. Catch, I want the code...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
11
by: redantho | last post by:
As a relative beginner with Access/VBA (2003 version), I am looking for a solution to what seems to be a fairly simple problem... When a user inputs a text string in a form object, I would like...
1
by: adampope | last post by:
Hi Access boffins, I've a form that I want to give users the option of choosing whether certain fields are visible or not. So I've created a table mirroring the original table called...
1
by: Simon | last post by:
Dear reader, In a Make-Table query the TickBox from the master table transfers in to a binary value in the new table. How can I force the Make-table query to keep the TickBox in the new...
2
by: John Bartley K7AAY | last post by:
When I output a table's values to XLS, one value in a very small table, and only one value, is changed. Here are the values in the table, tblLevel. LEVEL H-14 0 1 1.1
1
by: BigH | last post by:
I am using the following sql query via ODBC to pull data from a database into Access. SELECT table.excav_id, table.RecordID, table.indx_dpr, table.tons_bkt, ...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.