473,569 Members | 2,593 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Populate An Unbound Form with Recordset

194 New Member
Hello Everybody,

Please tell me is there any way to populate an unbound form of MS Access 2002 with Recordset of an MS Access 2002 external database??

if yes then how???

I dont wana link tables/queries what i want is to hold all data in recordset and then display it into the form like continuous forms.

thank u.
Nov 22 '07 #1
2 18613
FishVal
2,653 Recognized Expert Specialist
Hi, where.

You may try to use Form.Recordset property.
The following code bind an unbound form to table [t1] located in the same db.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)
  2.     Set Me.Recordset = CurrentDb.OpenRecordset("SELECT * FROM t1;")
  3. End Sub
  4.  
P.S. Sure, forms controls are expected to have right values in ControlSourcce property.
Nov 22 '07 #2
ADezii
8,834 Recognized Expert Expert
Hello Everybody,

Please tell me is there any way to populate an unbound form of MS Access 2002 with Recordset of an MS Access 2002 external database??

if yes then how???

I dont wana link tables/queries what i want is to hold all data in recordset and then display it into the form like continuous forms.

thank u.
Let's assume you wish to populate an Unbound Access Form consisting of three Unbound Text Boxes named txtFirstName, txtLastName, and txtBirthDate. Furthermore, the mechanism with which you wish to populate this Form is via a Recordset created on an External Database. In this scenario, the External Database is Northwind.mdb residing in the C:\Test\ Directory. We will use the Employees Table as the source of the Recordset and populate our Unbound Access Form and Text Boxes with 3 Fields from this Recordset. Follow these 3 simple steps:
  1. Place the following Declarations in the Form's Code Module (Declarations Section):
    Expand|Select|Wrap|Line Numbers
    1. Dim wrkJet As Workspace
    2. Dim dbsNorthwind As DAO.Database, rstNorthWind As DAO.Recordset
  2. Copy and Paste the following code to the Open() Event of the Form:
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Form_Open(Cancel As Integer)
    2. 'Create Microsoft Jet Workspace object.
    3. Set wrkJet = CreateWorkspace("", "admin", "", dbUseJet)
    4.  
    5. 'Open Database object from saved Microsoft Jet database for exclusive use
    6. Set dbsNorthwind = wrkJet.OpenDatabase("C:\Test\Northwind.mdb", True)
    7.  
    8. Set rstNorthWind = dbsNorthwind.OpenRecordset("Employees", dbOpenDynaset)
    9.  
    10. Set Me.Recordset = rstNorthWind
    11.  
    12. Me![txtFirstName].ControlSource = "FirstName"
    13. Me![txtLastName].ControlSource = "LastName"
    14. Me![txtBirthDate].ControlSource = "BirthDate"
    15. End Sub
  3. Place the following code in the Close() Event of the Form:
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Form_Close()
    2.   rstNorthWind.Close
    3.   Set rstNorthWind = Nothing
    4. End Sub
  4. This code has been tested and is fully operational, let me know how you make out.
Nov 22 '07 #3

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

Similar topics

4
3854
by: Tim Marshall | last post by:
This is an embarrassing question to which I should know the answer, but I am not 100% sure of myself. My applications, whether they are Jet or Oracle usually deal with reporting on existing apps that others have done and except for the odd single user app, I don't do many transaction type applications.... Anyways, I have an unbound form...
2
7917
by: ano1optimist | last post by:
I have a form with a search button. I'm using command parameters to pass search criteria to a stored procedure. Here is my code: Stored procedure: CREATE PROCEDURE . @strCriteria varchar(200) AS execute (@strCriteria) GO
1
9612
by: huela | last post by:
Somehow i have to display the recordset in unbound form When i use the following display the data in recordset to unbound form. I have a question: i can only display the last record data, all previous data are overwrittend. why i can't create the continues form or datasheet display the data line by line. Thanks a lot for the help
4
2895
by: Pierre | last post by:
Hi all, To ease load on a network i close automatically form open with a timer reset by user actions. If the time is expired i go through the collections of form and table and close all those that are open. I choose this way to avoid putting code in each form, plus i can close all open table if any
3
2261
by: Stig | last post by:
Hi, Any help on this one will be greatly appreciated as I have spent too long banging my head against the screen trying to get it sorted. Basically I would like to have a select all records option in a combo box that is used in an unbound form for my report parameter. I have tried to explain it in further detail below: - In my DB I have...
0
1379
by: ndindi22 | last post by:
HI guys, How do I Add/ Edit/ Delete using Unbound MS Access .adp Project/ VBA Form I need to populate the form manually by executing SQL statements in the VBA code. Add buttons to the form to position to the first, last, next, and previous row. Add buttons that facilitate add, edit, and delete through the use of SQL. My MS Access form,...
6
2669
by: Volker Neurath | last post by:
Hi all, I have a Problem with combobox-property "NotInList" and an unbound Form. The situation: On my main form i have three comboboxes for data-exchange (here: Names of distributor, reseller and final customers, the whole database is made for storing information about quotatations - no, not for quoting itself) ut the boxes actually...
8
5883
patjones
by: patjones | last post by:
Hi: There are many posts both here and on other forums about this topic, but nothing quite matching what I have... I have an unbound form called frmChecks which displays information by means of an ADO recordset. Whenever I search for something, I have a globally defined subroutine, UpdateForm, that uses a SQL string to pull information into...
7
5546
by: troy_lee | last post by:
I have an unbound form. I have an Add New procedure that saves a new record to the database. What is the best way to update an existing record? In other words, clicking my "Submit record" button creates another new instance of the record when all I want is to update a field or two and save over the existing record. Thanks in advance. Troy
0
7924
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8125
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7974
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.