Referring to access records - Should be easy but not for me.

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
Hi, i have question on how to refer to range in access?
Suppose i want to edit ID no 107 instead of looping how can i go and directly refer to that record and edit/delete....

Thanks everyone
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
"Range" really has no meaning in Access. That is an Excel term.
Data is stored in Access as "records". Their position is relation to other records in the table really has no meaning, unless you are sorting and looping through as record set.

What version of Access do you have?
If you have Access 2007 or later, just open the table/query where the data resides, click on the Filter button above the field you want to identify, and enter the value you want to look for. That will bring up the records meeting that criteria.

Or, to delete the record via code, you can use a SQL statement like:
Code:
DELETE [MyTableName].*
FROM [MyTableName]
WHERE [ID]=107;
You could also create a Delete Query to do that using the Query Builder instead of writing the SQL code directly.
 
Upvote 0
Joe4, thanks for quick reply...
'm not familiar with sql line though it plays very important role in access data manipulation.

To be specific, i want to know how to refer to in this way like

Code:
[/FONT]
[FONT=Courier New]rst.edit[/FONT]
[FONT=Courier New]rst!myheadername(record/rownum) = "somthing"[/FONT]
[FONT=Courier New]rst.update[/FONT]
[FONT=Courier New]

Please advice me this way if there is anything like this...


Thanks again!
 
Upvote 0
Pedie

Why can't you use 'normal' built-in Access queries etc with all the functionality the give you?

If you are coding everything then why are you even using Access?

It could probably be done with Excel as a frontend, or perhaps you could build your own application.

The latter would give you a lot more options, for example you wouldn't have an application to hide.
 
Upvote 0

Why can't you use 'normal' built-in Access queries etc with all the functionality the give you?

If you are coding everything then why are you even using Access?

It could probably be done with Excel as a frontend, or perhaps you could build your own application.

The latter would give you a lot more options, for example you wouldn't have an application to hide.



Norie, I understand, you're right....but it is that i want to know it in vba way to...Query...'m getting into it...
moreover, I dont know how to use the query/sql line within the code...
I have read so many things but cant understand it...:confused::)

Pedie





 
Upvote 0
Pedie

You've kind of got this the wrong way round.

If you do want to do this with code you will eventually have to write your own SQL statements.

So even if you know the code you also need to know SQL.
 
Upvote 0
Pedie

You've kind of got this the wrong way round.

If you do want to do this with code you will eventually have to write your own SQL statements.

So even if you know the code you also need to know SQL.

I agree with Norie - you must be strong with your SQL to be strong in any database development work.

It doesn't really matter but I see you are using ADO a lot. DAO is a natural fit with Access (its the "native language" of Access). You might find it easier to work with DAO if you're working with Access.

I use ADO for connecting to Access from Excel, or connecting to SQL Server, but I usually use DAO when I'm working with Access in Access.
 
Upvote 0

Forum statistics

Threads
1,224,537
Messages
6,179,408
Members
452,912
Latest member
alicemil

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