473,473 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Command button problem in a subform

26 New Member
Hi everyone,

I would like to create a Command button in a subform which can open a form related to the primary key in the current subform. Can anyone help?

Sorry if this question has been answered before.

Louise
Feb 8 '07 #1
2 1578
MMcCarthy
14,534 Recognized Expert Moderator MVP
Hi everyone,

I would like to create a Command button in a subform which can open a form related to the primary key in the current subform. Can anyone help?

Sorry if this question has been answered before.

Louise

Try this ...

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "FormName", , , "[PrimaryID]=" & Forms![MainformName]![SubformObject].Form![PrimaryID]
Feb 8 '07 #2
NeoPa
32,556 Recognized Expert Moderator MVP
...or even :
Expand|Select|Wrap|Line Numbers
  1. Call DoCmd.OpenForm("FormName",,,"[PrimaryID]=" & Me![SubformObject]![PrimaryID])
If the [PrimaryID] field is a string though, you'll need to surround it in single-quotes (').
Feb 10 '07 #3

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

Similar topics

2
by: Colin | last post by:
I have a main form with a command button on it that when clicked, opens a subform displaying records that relate to the main form. I would like to disable the command button if the corresponding...
1
by: dmkeith2 | last post by:
I have a command button on my subform that I would like to run when the subform loads. Is there a way to run the command button that is in the subform automatically. Thanks
2
by: dskillingstad | last post by:
I'm trying to assign a custom value to a textbox. Here's what I have. I've created a module and "default value" code for a textbox which generates a custom auto-number (yyyy-0000) when a New...
14
by: Kevin | last post by:
A couple of easy questions here hopefully. I've been working on two different database projects which make use of multiple forms. 1. Where's the best/recommended placement for command buttons...
2
by: emc_cos | last post by:
I have a very nice parent child relationship happening between a main form and 8 subforms. The main form is the data entry point for a table that holds textual data like names, notes and the...
3
by: afr0ninja | last post by:
Hello! I'm currently working on a form that has several input fields and a subform. What I'm trying to accomplish is that when I first open the form I'd like to have the input fields displayed...
0
by: M G Henry | last post by:
I am using Access 2003 and have a form with two subforms on them. I would like to be able to use a command button to add the row of data ( 5 fields ) that are completed on the subform, as well as...
1
by: Chris | last post by:
I need a search form to perform. I have a Form and a subform. The subform is based off a query and the main form is unbound. The query runs perfect, however, I have a command button in the main...
4
by: QntmPg | last post by:
Hi all I am trying to design a database that holds contact/demographic information on a person and what studies they have participated in. I have a few ideas, but wanted to get feedback on...
2
by: jmartmem | last post by:
I have an Access 2002 main form ("Project Update Form") with a subform ("sfEZMilestone"). What I want is to somehow change the subform to a command button so when a user clicks the command button,...
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...
0
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...
0
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,...
1
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...
0
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...
0
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...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.