same record when opening a new form

G

Guest

I have a form where I enter a new record with a comand button opning up a
another form. I need the opened form to be on the same record and show three
of hte values that were entered on the first form. How do i do this?
 
A

Arvin Meyer

Brandie said:
I have a form where I enter a new record with a comand button opning up a
another form. I need the opened form to be on the same record and show three
of hte values that were entered on the first form. How do i do this?

You'll also need to use some code to keep the second form closed if the
first is not open:

In the second form, set the default value property of the 3 controls and the
id control to:

=Forms!NameOfFirstForm!ControlNameOnFirstForm

Open the second form with:

DoCmd.OpenForm "SecondFormName",,,"ID=" & Me.txtID_Name
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access Downloads
http://www.datastrat.com
http://www.mvps.org/access
 
R

Rick B

When you add that command button, the wizard will walk you right through the
steps you mentioned.
 
G

Guest

That works...kinda. I have two of the fields as combe boxes on the first
form that look up from tables. The only problem is that when i open the
sencond form it shows the ID Number instead of the word. Should I just
delete the ID Column and use the word itself as the primary key for that
table?
 
G

Guest

I also have a comand button on the second form that opens a third. I need
the same thing to happen. I tried the same thing that you said for the
second form but it isn't working. Should i be doing something different?
 
G

Guest

Sorry..but i just tesed my forms and they are trying to create a new record
instead of going to the same record. And it won' tlet me do that because on
the first form, the three controls are set as the primary key. What now?
 
R

Rick B

Huh?

Follow the steps in the wizard. Right after you pick which form to open, it
will ask you if you'd like to open it to a particular record. Select that
option. It will then let you pick the field in each form that are related
(customer number, employee number, etc.).
 
R

Rick B

Do you not have a single field that identifies the record? A unique primary
key?

You should.
 
R

Rick B

I guess I would build it using the wizard with one field, then go in after
the wizard does all the work and figure out how to modify the code to work.
 
G

Guest

Arvin...are you there? Can you please help me because Rick B isn't. Your
post was the most intelligent I've seen.
 
R

Rick B

Now in the thread with arvin you mention "id number". This is telling me
that you have a UNIQUE ENTRY to identify the record.

What is this table? What are the fields?

Since your most recent post indicates that I am not helping and not posting
intelligent responses, I'll try to help if I have time, but I'm obvioulsy
not being much use to you.
 
G

Guest

Sorry about the last post..but you're saying to modify the code and not how
to modify it. If there is something that I should be doing I would
appreciate you saying what it is, not just that I need to do it.

I have a table with SubjectID and the Subject Name

I have another table with TechnologyID and Technology Name

The first form contains many controls but three of them are the Project
Number and two combo boxes to look up a subject and a technology. When I
open the second form, I need it to be the same record (i.e. the same Project
Number, Subject, and Technology). What Arvin said worked except it tryies to
crate a new record for each form. And I can't do that because those three
controls make up the primary key for the main table. They also show the ID
Number instead of the actual subject or technology when I open the new form.
Can you help with these?
 
R

Rick B

Okay, a form has ONE record on it. You are confusing RECORDS and CONTROLS
here. (in my opnion).

You are saying that you want to open a particular Subject ID record *AND* a
particular Technology ID record?


This does not make sense. Are you trying to open a particular record, or
are you trying to populate three controls in a form?

They are completely different things.
 
G

Guest

I know that form has one record. The first form has a record and in that
record there are look ups to the subject table and the technology table.
These and the Project Number make up the primary key for the main table(all
togehter). The seconf form runs off a query that runs off of the main table.
When I enter information into the first form and click on the comand button,
it saves the form and opens the second. I need the second to display the
first three fields acording to the record shown on the first form(i.e.it
needs to be the same record) does this explain it?
 
A

Arvin Meyer

Brandie said:
That works...kinda. I have two of the fields as combe boxes on the first
form that look up from tables. The only problem is that when i open the
sencond form it shows the ID Number instead of the word. Should I just
delete the ID Column and use the word itself as the primary key for that
table?

No do not delete the ID column. If you need the word it may be Column(1) ...
zero based index. So change the default value to:

=Forms!NameOfFirstForm!ControlNameOnFirstForm.Column(1)
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access Downloads
http://www.datastrat.com
http://www.mvps.org/access
 
A

Arvin Meyer

The record on the second form doesn't really exist until you put at least 1
keystroke in it, or otherwise force the record, and then save it. So the
command button needs to precede the open form line of code with:

DoCmd.RunCommand acCmdSaveRecord

Make sure you have something to save. You can't just save an empty default
record.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access Downloads
http://www.datastrat.com
http://www.mvps.org/access
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top