Form Button to Open another Form

C

channell

Hello,

I have a main form with a subform(continuous forms) in it. On this subform,
I have a field that has a button next to it. If I press this button, it will
open another form(continuous forms) that is linked to it to have the ability
to see, edit, add and delete extra information. I have the following code,
and it works only to let me open the form. I can add information, but once I
close it, it is gone forever. If I click the button to open the form, the
information is not displayed and I can't recover it.

What am I doing wrong? Thank you very much for the help!

Private Sub MagGlass_Click()

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "fMRDETAILS"

stLinkCriteria = "[DAILYINFO ID]=" & Me![DAILYINFO ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sud
 
D

Douglas J. Steele

Check that the form's DataEntry property isn't set to Yes.

The Data Entry property doesn't determine whether records can be added; it
only determines whether existing records are displayed.
 
C

channell

Douglas,

I tried it, messed around with a few more things, but it still doesn't work.
I am really not sure what I am doing wrong with this.

Any other Suggestions?

Thank you!

Douglas J. Steele said:
Check that the form's DataEntry property isn't set to Yes.

The Data Entry property doesn't determine whether records can be added; it
only determines whether existing records are displayed.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


channell said:
Hello,

I have a main form with a subform(continuous forms) in it. On this
subform,
I have a field that has a button next to it. If I press this button, it
will
open another form(continuous forms) that is linked to it to have the
ability
to see, edit, add and delete extra information. I have the following
code,
and it works only to let me open the form. I can add information, but
once I
close it, it is gone forever. If I click the button to open the form, the
information is not displayed and I can't recover it.

What am I doing wrong? Thank you very much for the help!

Private Sub MagGlass_Click()

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "fMRDETAILS"

stLinkCriteria = "[DAILYINFO ID]=" & Me![DAILYINFO ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sud
 
D

Douglas J. Steele

What's the recordsource of the form? Might it be limiting what data's
returned?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


channell said:
Douglas,

I tried it, messed around with a few more things, but it still doesn't
work.
I am really not sure what I am doing wrong with this.

Any other Suggestions?

Thank you!

Douglas J. Steele said:
Check that the form's DataEntry property isn't set to Yes.

The Data Entry property doesn't determine whether records can be added;
it
only determines whether existing records are displayed.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


channell said:
Hello,

I have a main form with a subform(continuous forms) in it. On this
subform,
I have a field that has a button next to it. If I press this button,
it
will
open another form(continuous forms) that is linked to it to have the
ability
to see, edit, add and delete extra information. I have the following
code,
and it works only to let me open the form. I can add information, but
once I
close it, it is gone forever. If I click the button to open the form,
the
information is not displayed and I can't recover it.

What am I doing wrong? Thank you very much for the help!

Private Sub MagGlass_Click()

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "fMRDETAILS"

stLinkCriteria = "[DAILYINFO ID]=" & Me![DAILYINFO ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sud
 
C

channell

What it is doing is NOT linking itself to the ID Number of the Subform. In
other words, the form that pops up when I click a button on the other form,
when information is entered, is not accepting it after I close the pop up
form. If I go to the table, the information is there, but the linked ID
Number is blank. Therefore, it is not associating the linked ID number with
the records.

Now, if I, instead of making a pop-up form, put the that form into the
existing continuous subform, the subform on the master turn to single form
view, and the new subform works as a subform. I, however, do not want
another subform, I want a pop-up form. It is really frustrating me.

I read some of your other posts, and I remade the form, compacted and
repaired, and I imported. Nothing.

I am so lost. Thanks for your help Douglas.

-Scott Channell

Douglas J. Steele said:
What's the recordsource of the form? Might it be limiting what data's
returned?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


channell said:
Douglas,

I tried it, messed around with a few more things, but it still doesn't
work.
I am really not sure what I am doing wrong with this.

Any other Suggestions?

Thank you!

Douglas J. Steele said:
Check that the form's DataEntry property isn't set to Yes.

The Data Entry property doesn't determine whether records can be added;
it
only determines whether existing records are displayed.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Hello,

I have a main form with a subform(continuous forms) in it. On this
subform,
I have a field that has a button next to it. If I press this button,
it
will
open another form(continuous forms) that is linked to it to have the
ability
to see, edit, add and delete extra information. I have the following
code,
and it works only to let me open the form. I can add information, but
once I
close it, it is gone forever. If I click the button to open the form,
the
information is not displayed and I can't recover it.

What am I doing wrong? Thank you very much for the help!

Private Sub MagGlass_Click()

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "fMRDETAILS"

stLinkCriteria = "[DAILYINFO ID]=" & Me![DAILYINFO ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sud
 
D

Douglas J. Steele

You'll have to populate that field yourself.

You're passing a criteria when you open the form: to be honest, I'm not sure
it's even necessary. What you need to pass is the value of [DAILYINFO ID] as
an OpenArgs parameter:

DoCmd.OpenForm stDocName, , , stLinkCriteria, _
OpenArgs:= [DAILYINFO ID]

Then, in the BeforeUpdate event of your pop-up form, put something like:

Private Sub Form_BeforeUpdate(Cancel As Integer)

If IsNull(Me.OpenArgs) = False Then
Me.[DAILYINFO ID] = Me.OpenArgs
End If

End Sub

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


channell said:
What it is doing is NOT linking itself to the ID Number of the Subform.
In
other words, the form that pops up when I click a button on the other
form,
when information is entered, is not accepting it after I close the pop up
form. If I go to the table, the information is there, but the linked ID
Number is blank. Therefore, it is not associating the linked ID number
with
the records.

Now, if I, instead of making a pop-up form, put the that form into the
existing continuous subform, the subform on the master turn to single form
view, and the new subform works as a subform. I, however, do not want
another subform, I want a pop-up form. It is really frustrating me.

I read some of your other posts, and I remade the form, compacted and
repaired, and I imported. Nothing.

I am so lost. Thanks for your help Douglas.

-Scott Channell

Douglas J. Steele said:
What's the recordsource of the form? Might it be limiting what data's
returned?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


channell said:
Douglas,

I tried it, messed around with a few more things, but it still doesn't
work.
I am really not sure what I am doing wrong with this.

Any other Suggestions?

Thank you!

:

Check that the form's DataEntry property isn't set to Yes.

The Data Entry property doesn't determine whether records can be
added;
it
only determines whether existing records are displayed.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Hello,

I have a main form with a subform(continuous forms) in it. On this
subform,
I have a field that has a button next to it. If I press this
button,
it
will
open another form(continuous forms) that is linked to it to have the
ability
to see, edit, add and delete extra information. I have the
following
code,
and it works only to let me open the form. I can add information,
but
once I
close it, it is gone forever. If I click the button to open the
form,
the
information is not displayed and I can't recover it.

What am I doing wrong? Thank you very much for the help!

Private Sub MagGlass_Click()

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "fMRDETAILS"

stLinkCriteria = "[DAILYINFO ID]=" & Me![DAILYINFO ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sud
 
C

channell

Hello,

Thank you soooooo very much for helping me out and sticking with me! Ok, so
what the heck does OpenArgs do? This is the firts time I have encountered
this. Is this something I would need to use on other pop-up forms I have?
Interesting. Thanks again though Douglas. You are a genius!

-Scott Channell
(e-mail address removed)

Douglas J. Steele said:
You'll have to populate that field yourself.

You're passing a criteria when you open the form: to be honest, I'm not sure
it's even necessary. What you need to pass is the value of [DAILYINFO ID] as
an OpenArgs parameter:

DoCmd.OpenForm stDocName, , , stLinkCriteria, _
OpenArgs:= [DAILYINFO ID]

Then, in the BeforeUpdate event of your pop-up form, put something like:

Private Sub Form_BeforeUpdate(Cancel As Integer)

If IsNull(Me.OpenArgs) = False Then
Me.[DAILYINFO ID] = Me.OpenArgs
End If

End Sub

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


channell said:
What it is doing is NOT linking itself to the ID Number of the Subform.
In
other words, the form that pops up when I click a button on the other
form,
when information is entered, is not accepting it after I close the pop up
form. If I go to the table, the information is there, but the linked ID
Number is blank. Therefore, it is not associating the linked ID number
with
the records.

Now, if I, instead of making a pop-up form, put the that form into the
existing continuous subform, the subform on the master turn to single form
view, and the new subform works as a subform. I, however, do not want
another subform, I want a pop-up form. It is really frustrating me.

I read some of your other posts, and I remade the form, compacted and
repaired, and I imported. Nothing.

I am so lost. Thanks for your help Douglas.

-Scott Channell

Douglas J. Steele said:
What's the recordsource of the form? Might it be limiting what data's
returned?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Douglas,

I tried it, messed around with a few more things, but it still doesn't
work.
I am really not sure what I am doing wrong with this.

Any other Suggestions?

Thank you!

:

Check that the form's DataEntry property isn't set to Yes.

The Data Entry property doesn't determine whether records can be
added;
it
only determines whether existing records are displayed.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Hello,

I have a main form with a subform(continuous forms) in it. On this
subform,
I have a field that has a button next to it. If I press this
button,
it
will
open another form(continuous forms) that is linked to it to have the
ability
to see, edit, add and delete extra information. I have the
following
code,
and it works only to let me open the form. I can add information,
but
once I
close it, it is gone forever. If I click the button to open the
form,
the
information is not displayed and I can't recover it.

What am I doing wrong? Thank you very much for the help!

Private Sub MagGlass_Click()

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "fMRDETAILS"

stLinkCriteria = "[DAILYINFO ID]=" & Me![DAILYINFO ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sud
 
D

Douglas J. Steele

OpenArgs is a string you can pass to a form (or report) when opening it.
You can pack as much or as little information into the string as you want,
and you'd then unpack it in the form you opened.

I'll sometimes pass a fairly complicated string along the lines of:

Cust=12345;Product=ABC;InvoiceDate=2009-02-12

and decipher it using code like:

Private Sub Form_Load()

Dim lngLoop As Long
Dim varParm As Variant
Dim varParms As Variant

If IsNull(Me.OpenArgs) = False Then
varParms = Split(Me.OpenArgs, ";")
For lngLoop = LBound(varParms) To UBound(varParms)
varParm = Split(varParms(lngLoop), "=")
If UBound(varParm) < 1 Then
MsgBox "OpenArgs error"
Else
Select Case varParm(0)
Case "Cust"
Me.txtCust = varParm(1)
Case "InvoiceDate"
Me.txtInvDate = CDate(varParm(1))
Case "Product"
Me.txtProduct = varParm(1)
Case Else
MsgBox "Sorry, I don't know what to do with " & _
varParm(0)
End Select
End If
Loop
End If


With flexible code like that, I could just as easily pass any of the
following instead:

Cust=12345;InvoiceDate=2009-02-12;Product=ABC
InvoiceDate=2009-02-12;Cust=12345;Product=ABC
InvoiceDate=2009-02-12;Product=ABC;Cust=12345
Product=ABC;Cust=12345;InvoiceDate=2009-02-12
Product=ABC;InvoiceDate=2009-02-12;Cust=12345

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


channell said:
Hello,

Thank you soooooo very much for helping me out and sticking with me! Ok,
so
what the heck does OpenArgs do? This is the firts time I have encountered
this. Is this something I would need to use on other pop-up forms I have?
Interesting. Thanks again though Douglas. You are a genius!

-Scott Channell
(e-mail address removed)

Douglas J. Steele said:
You'll have to populate that field yourself.

You're passing a criteria when you open the form: to be honest, I'm not
sure
it's even necessary. What you need to pass is the value of [DAILYINFO ID]
as
an OpenArgs parameter:

DoCmd.OpenForm stDocName, , , stLinkCriteria, _
OpenArgs:= [DAILYINFO ID]

Then, in the BeforeUpdate event of your pop-up form, put something like:

Private Sub Form_BeforeUpdate(Cancel As Integer)

If IsNull(Me.OpenArgs) = False Then
Me.[DAILYINFO ID] = Me.OpenArgs
End If

End Sub

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


channell said:
What it is doing is NOT linking itself to the ID Number of the Subform.
In
other words, the form that pops up when I click a button on the other
form,
when information is entered, is not accepting it after I close the pop
up
form. If I go to the table, the information is there, but the linked
ID
Number is blank. Therefore, it is not associating the linked ID number
with
the records.

Now, if I, instead of making a pop-up form, put the that form into the
existing continuous subform, the subform on the master turn to single
form
view, and the new subform works as a subform. I, however, do not want
another subform, I want a pop-up form. It is really frustrating me.

I read some of your other posts, and I remade the form, compacted and
repaired, and I imported. Nothing.

I am so lost. Thanks for your help Douglas.

-Scott Channell

:

What's the recordsource of the form? Might it be limiting what data's
returned?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Douglas,

I tried it, messed around with a few more things, but it still
doesn't
work.
I am really not sure what I am doing wrong with this.

Any other Suggestions?

Thank you!

:

Check that the form's DataEntry property isn't set to Yes.

The Data Entry property doesn't determine whether records can be
added;
it
only determines whether existing records are displayed.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Hello,

I have a main form with a subform(continuous forms) in it. On
this
subform,
I have a field that has a button next to it. If I press this
button,
it
will
open another form(continuous forms) that is linked to it to have
the
ability
to see, edit, add and delete extra information. I have the
following
code,
and it works only to let me open the form. I can add
information,
but
once I
close it, it is gone forever. If I click the button to open the
form,
the
information is not displayed and I can't recover it.

What am I doing wrong? Thank you very much for the help!

Private Sub MagGlass_Click()

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "fMRDETAILS"

stLinkCriteria = "[DAILYINFO ID]=" & Me![DAILYINFO ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sud
 

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

Similar Threads


Top