473,387 Members | 3,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Open form to specific record

1
I have read several responses to this problem around the web, but my programming knowledge wasn't strong enough to translate those responses to my problem.

I have a database with one table, the primary key of this table is called ID Number (It is a number, not a string). There are two forms in the database, and I made a button to switch from one form to the other. When I am in Form1, I want to be able to click the button to go to Form2, while remaining on the same record (I would prefer if Form2 was now filtered so you cannot scroll to any other records).

The command DoCmd.OpenForm "Form2" does not work since it will open to record 1 every time. I have also tried DoCmd.OpenForm "Form 2" , , , [ID Number] = Me! [ID Number] but that produced an error. I think I might not have the right syntax or I might be writing [ID Number] incorrectly.
May 5 '07 #1
4 32416
JConsulting
603 Expert 512MB
I have read several responses to this problem around the web, but my programming knowledge wasn't strong enough to translate those responses to my problem.

I have a database with one table, the primary key of this table is called ID Number (It is a number, not a string). There are two forms in the database, and I made a button to switch from one form to the other. When I am in Form1, I want to be able to click the button to go to Form2, while remaining on the same record (I would prefer if Form2 was now filtered so you cannot scroll to any other records).

The command DoCmd.OpenForm "Form2" does not work since it will open to record 1 every time. I have also tried DoCmd.OpenForm "Form 2" , , , [ID Number] = Me! [ID Number] but that produced an error. I think I might not have the right syntax or I might be writing [ID Number] incorrectly.
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "YourForm", , , "[ID Number]=" & Me.[ID Number]
May 5 '07 #2
I have a similar problem, but with a tabbed control,
i have a main form that is on a set record, i have a button on it to open a tabbed control that has numerous files embeded in it that contain the related information to it,
ive tried the normal
DoCmd.OpenForm "YourForm", , , "[ID Number]=" & Me.[ID Number]
that doesnt work, even if i put a copy of the ID control of the main form on the tab container form which I realise isnt linked to the other forms anyway, i need the way to link them.
the tab control is the only thing on the form, is there a way to link the tabbed forms together to respond to the main form... I hope this one makes sense.
May 6 '07 #3
JConsulting
603 Expert 512MB
I have a similar problem, but with a tabbed control,
i have a main form that is on a set record, i have a button on it to open a tabbed control that has numerous files embeded in it that contain the related information to it,
ive tried the normal
DoCmd.OpenForm "YourForm", , , "[ID Number]=" & Me.[ID Number]
that doesnt work, even if i put a copy of the ID control of the main form on the tab container form which I realise isnt linked to the other forms anyway, i need the way to link them.
the tab control is the only thing on the form, is there a way to link the tabbed forms together to respond to the main form... I hope this one makes sense.

Shouldn't this be a separate question?
The problem you're having with your tab control is that you lose the record number as soon as you leave the record to press the button. Your case would have to point to the ID on the parent form IF it is linked to the record on the tabbed form. Normally you link tabbed forms together by putting a text box on the main form with the primary ID and link your subforms to it using the Master/Child relationship.
J
May 6 '07 #4
Shouldn't this be a separate question?
The problem you're having with your tab control is that you lose the record number as soon as you leave the record to press the button. Your case would have to point to the ID on the parent form IF it is linked to the record on the tabbed form. Normally you link tabbed forms together by putting a text box on the main form with the primary ID and link your subforms to it using the Master/Child relationship.
J
Yes that was the problem, now solved after a days dig round,
using this

Private Sub Form_BeforeInsert(Cancel As Integer)
Me.[Inspection ID] = Forms![Booking Form]![ID]
End Sub

and taking the forms in the tabs off queries and back to straight from the tables which then allowed me to set the links via the wizard also.

working ok now
thanks for the efforts...
May 7 '07 #5

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

Similar topics

1
by: Ian | last post by:
I want to open a form at a particular record, but I think I'm running into problems because the recordsource query is executing asynchronously. In the form's open event I use...
2
by: XxLicherxX | last post by:
Hi, Can someone tell me how I can open a form to a specific record from a button on another form. Here is what I want to have happen. I have one form called Computers and another form called...
2
by: nkoske | last post by:
I have a form with a subform in datasheet view and I have a event on one of the fields in the subform, so that the user can double click it and go to expanded information based on that field. ...
2
by: Jpipher | last post by:
Let me explain what I am trying to accomplish... Two forms -- we'll call them "Main" and "Related" A command button on "Main" runs a union query. The union query results are shown in "Related"...
3
by: kev | last post by:
Hi folks, I have a form for registration (frmRegistration) whereby i have two buttons. One is Save which saves record using the OnClick property. I used wizard to create the save button. The...
3
by: DavidB | last post by:
I want to be able to go to a specific record on my form when I open it. The record I want to go to will be dynamic based on the value currently stored in a global variable. The global contains...
1
by: Martin Bentler | last post by:
Right now, I have a form, locked records, on which I have a CommandButton that opens a second form (much like the first) but open for editing, plus allowing the user to manipulate other areas of the...
1
by: cvillav | last post by:
Hello, I am new to Access and this forums, I have two tables and two forms to display the data. Tables Tbuilding Tcriteria Forms fmbuilding
8
reginaldmerritt
by: reginaldmerritt | last post by:
Hi, I'm using the following code to open a form on a specific record. I have a form displaying records in a list which then allows users to click onto the record to open it up in a new form in a...
1
by: aaron knezevic | last post by:
I'm attempting to open an access file, form and go to a specific record from an autocad drawing. using excell and creating a macro I've gotten as far as to get the form open but can't get to the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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,...
0
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...

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.