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

Home Posts Topics Members FAQ

Linking Forms to Tables using VB code

1 New Member
I am using a form called EnterData to input data into a table and I am having issues getting the Form to link properly. I open EnterData in another form called NewReport. In NewReport I use the following code:

Expand|Select|Wrap|Line Numbers
  1. Dim stDocName As String
  2. Dim stLinkCriteria As String
  3.  
  4. stDocName = "EnterData"
  5. Forms!EnterData.RecordSource = "SELECT * FROM Employee10"
  6. DoCmd.OpenForm stDocName, , , stLinkCriteria
I create the table Employee10 with several columns and then call the above code. However when I call the above code, the form is opened but never linked to the right table. Thoughts?

Thanks
Jun 28 '07 #1
1 1848
MMcCarthy
14,534 Recognized Expert Moderator MVP
I am using a form called EnterData to input data into a table and I am having issues getting the Form to link properly. I open EnterData in another form called NewReport. In NewReport I use the following code:

Expand|Select|Wrap|Line Numbers
  1. Dim stDocName As String
  2. Dim stLinkCriteria As String
  3.  
  4. stDocName = "EnterData"
  5. Forms!EnterData.RecordSource = "SELECT * FROM Employee10"
  6. DoCmd.OpenForm stDocName, , , stLinkCriteria
I create the table Employee10 with several columns and then call the above code. However when I call the above code, the form is opened but never linked to the right table. Thoughts?

Thanks
You can't set the record source before the form is open. Try putting this in the load event of the EnterData form.

Me.RecordSource = "SELECT * FROM Employee10"
Jul 4 '07 #2

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

Similar topics

3
4376
by: John South | last post by:
I have an Access 2000 front end that I wish to work with a SQL Server 2000 database by means of Linked tables. Do I have to use an ODBC connection to SQL Server? It seems to be the only option offered in the table linking dialog. Is there a more direct connection with OLE_DB? John South Pangbourne UK
14
2937
by: diskoduro | last post by:
Hi!! Years ago I built a database to control the production of a little factory. The users wanted to work in a Windows Net workgroup so I created an mdb with all the tables and data an after that every user had his own mde linked to the main mdb. Year by year, progressively the number of records has been growing and the speed of the...
0
2232
by: gasturbtec | last post by:
please help im new at access programming and i just got this project dropped in my lap because the old programmer quit. i've been doing ok so far but now i need to add code to an existing database that is used to connect to other databases and generate reports. below is sample code of how the database does the linking i hope i give you enough...
18
3058
by: Mark P | last post by:
I have a bit of vb code that uses Tables.Append to programatically link tables from Oracle and DB2 datasources. The problem I am having on some client machines is that the link will take anywhere from 1 to 3 minutes to link the table. When I manually link the tables,through Access, it takes no time at all. Note that only certain client have...
11
4508
by: dskillingstad | last post by:
I've been struggling with this problem for some time and have tried multiple solutions with no luck. Let me start with, I'm a novice at Access and I'm not looking for someones help to design my database,just help in getting me pointed in the right direction. I have a database with 8 tables, which from what I have read, cannot be linked...
2
800
by: davy d | last post by:
I'm having a problem with an acess form linkin with another form. My index in the main form is Autonumber (Rec#) the 2nd form is called Record# and it is set for text. The link criteria works well with linking these 2 forms together with these conditiosn, here is the vb code: stLinkCriteria = "=" & "'" & Me! & "'" but the problem is when...
2
1869
by: watto | last post by:
I have a large database application with user data in a backend and forms, code etc in a frontend. It includes a facility for migrating data from an earlier backend to the current backend by linking to the second backend and moving data between corresponding tables. Problem is that Access invariably crashes during this process. I have taken...
3
3170
by: TonyJH226 | last post by:
I’m using Access 2003 and am a novice to Access. I am creating a form to facilitate data entry to seven tables. The main table (A) has four sub-tables that are related to the main table by one-to-one relationships. A fifth sub-table (B) has a one-to-many relationship to Table A and serves as a bridge to another table (C) also with a...
0
7173
by: Tarik Monem | last post by:
I have been working on an all AJAX/DOM web site which is set to go live today and I thought I'd share my discoveries with all of you whom have helped me when I have encountered different issues along the way. First, deep linking is not something that a completely AJAX web site should be able to do by it's very nature of everything being on one...
3
1895
by: BASSPU03 | last post by:
(I'm using Access 2003 on a Windows XP O/S.) I have four tables that are related in the following order: tblFiscalYear > tblBulkObligations > tblProjects > tblResources These are their fields: tblFiscalYear ==========
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
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
8122
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
7970
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...
0
6284
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
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...
1
2113
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
1
1213
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
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.