473,386 Members | 1,835 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,386 software developers and data experts.

How to open form on specific record?

reginaldmerritt
201 100+
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 single view.

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "FRMBookingDetails", , "[BookingID] = " & Me.BookingID
  2.  
The form opens only on the first record only and never the chosen record. Sometimes it opens the form on a new record.

I'm guessing this has something to do with filtering but not sure what i should be checking for.

Thanks.
Feb 26 '11 #1
8 31316
munkee
374 256MB
I would be checking to ensure the form you are opening up has the field [BookingID] somewhere within its record.

Other than that it could be an issue with your form properties set wrong usually Allow Filter = false etc
Feb 27 '11 #2
reginaldmerritt
201 100+
Thanks munkee.

That was my first thought. But filter setting are set to true and i have the PK BookingID on the form.

I changed the code to the following and it seems to be working again now, not sure why.

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "FRMBookingDetails", acNormal, , "[BookingID] = " & Me.BookingID
  2.  
Feb 27 '11 #3
munkee
374 256MB
Weird. I wouldnt have expected adding the acnormal to change anything unless you have some properties set up within you form to only open in design view :| which once again I wouldnt expect.
Feb 28 '11 #4
TheSmileyCoder
2,322 Expert Mod 2GB
The acNormal is the default value, so I doubt that the change there is what fixed the problem.

I have noticed on occasion that if I have the form open in design view, and then switch to normal view, that I do not get the same behavior as if I had closed the form, and then reopened it.
Feb 28 '11 #5
reginaldmerritt
201 100+
That's a good point SmileyCoder. I've just noticed the same thing. Even if you make sure you save the changes sometimes there can be unexpected events if the form is not closed and then reopened.

I've only noticed this with DoCmd.OpenForm, but perhaps this effects other functions.

When ever i get any strange things happening i'm going to try this from now on.
Mar 9 '11 #6
Lysander
344 Expert 100+
I think you are missing a ' in your first example

You say
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "FRMBookingDetails", , "[BookingID] = " & Me.BookingID
  2.  
Should it not be
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "FRMBookingDetails", , ,"[BookingID] = " & Me.BookingID
  2.  
Mar 9 '11 #7
TheSmileyCoder
2,322 Expert Mod 2GB
I think Lysander has a good point, exept that he meant to type , and not '. In your second example where you included the acNormal, you had the correct amount of [,].
Mar 9 '11 #8
reginaldmerritt
201 100+
Sorry should have copied and pasted instead of writing it out. I do have the correct amount of commas in my code, but well spotted. Thanks SmileyCoder
Mar 9 '11 #9

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...
3
by: Chris | last post by:
Hello all. I have a database that I use to send email updates to people. Everything is working fine, but one suggestion I keep getting is to add a link to the automatic emails that will open up the...
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...
3
by: getro | last post by:
Hi Everyone, I need to open an Access 2003 form to a specific record from a custom Outlook 2003 Appointment form. The form has a command button that would pass a record id to access and open the...
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
2
by: eko99312 | last post by:
Let's say I have this form called Attendance List. The list was in datasheet form. In the list there were names and date checklist. The question is, I want to edit one of the names by double clicking...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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.