Double click to open form and create new record

G

Guest

Hi team,

Have scoured all of the posts and tried several different things for days
but just can't seem to nut this one out.

I have a form (FrmSeedBankStockAvailable) in datasheet view that lists seed
lots by BatchID. I want to be able to double click on the record selector
for a particular batch and have a form (DialogSeedBankWithdrawal) open so
that I can make a new withdrawal entry, with the BatchID already entered from
the selected record. I know that to do this I need to use the forms'
DblClick property. I have been using the following code (and tried
variations of from other posts).

DoCmd.OpenForm "DialogSeedBankWithdrawal", , , "[BatchID] = " & Me!BatchID,
acFormAdd

Some of the time I just get a blank form, and other times when I got the
code close it would ask for the paratmeter but the particular batch ID would
be in the pop up. I know it is probably something very simple.

Thanks in advance for anyone who can help.

Damo G
 
G

Guest

There is no much point on openning the form with a criteria (WhereCondition)
if you open the form with acFormAdd, which mean open the form for data input
only.

Instead open the form without a criteria, and pass the Me!BatchID to the
next form using the OpenArgs

DoCmd.OpenForm "DialogSeedBankWithdrawal", , , , , , Me.BatchID

On the OnLoad event of the DialogSeedBankWithdrawal form write the code

If Me.NewRecord And Not IsNull(Me.OpenArgs) Then
Me.BatchID = Me.OpenArgs
End If
 
G

Guest

Thanks for the quick response Ofer.

I cut and pasted your code. Upon execution the DialogSeedBankWithdrawal
form did open, but it didn't create a new entry and just listed all of the
withdrawal records none of which matched the BatchID. Do I need to change
the properties of the DialogSeedBankWithdrawal form or is there a bit missing
from the code?

Thanks and regards,

Damo G

Ofer Cohen said:
There is no much point on openning the form with a criteria (WhereCondition)
if you open the form with acFormAdd, which mean open the form for data input
only.

Instead open the form without a criteria, and pass the Me!BatchID to the
next form using the OpenArgs

DoCmd.OpenForm "DialogSeedBankWithdrawal", , , , , , Me.BatchID

On the OnLoad event of the DialogSeedBankWithdrawal form write the code

If Me.NewRecord And Not IsNull(Me.OpenArgs) Then
Me.BatchID = Me.OpenArgs
End If

--
Good Luck
BS"D


Damo G said:
Hi team,

Have scoured all of the posts and tried several different things for days
but just can't seem to nut this one out.

I have a form (FrmSeedBankStockAvailable) in datasheet view that lists seed
lots by BatchID. I want to be able to double click on the record selector
for a particular batch and have a form (DialogSeedBankWithdrawal) open so
that I can make a new withdrawal entry, with the BatchID already entered from
the selected record. I know that to do this I need to use the forms'
DblClick property. I have been using the following code (and tried
variations of from other posts).

DoCmd.OpenForm "DialogSeedBankWithdrawal", , , "[BatchID] = " & Me!BatchID,
acFormAdd

Some of the time I just get a blank form, and other times when I got the
code close it would ask for the paratmeter but the particular batch ID would
be in the pop up. I know it is probably something very simple.

Thanks in advance for anyone who can help.

Damo G
 
O

Ofer Cohen

Sorry, I missed the "acFormAdd" in the OpenForm command line

DoCmd.OpenForm "DialogSeedBankWithdrawal", , , , , , Me.BatchID,acFormAdd

Good Luck
BS"D

Damo G said:
Thanks for the quick response Ofer.

I cut and pasted your code. Upon execution the DialogSeedBankWithdrawal
form did open, but it didn't create a new entry and just listed all of the
withdrawal records none of which matched the BatchID. Do I need to change
the properties of the DialogSeedBankWithdrawal form or is there a bit missing
from the code?

Thanks and regards,

Damo G

Ofer Cohen said:
There is no much point on openning the form with a criteria (WhereCondition)
if you open the form with acFormAdd, which mean open the form for data input
only.

Instead open the form without a criteria, and pass the Me!BatchID to the
next form using the OpenArgs

DoCmd.OpenForm "DialogSeedBankWithdrawal", , , , , , Me.BatchID

On the OnLoad event of the DialogSeedBankWithdrawal form write the code

If Me.NewRecord And Not IsNull(Me.OpenArgs) Then
Me.BatchID = Me.OpenArgs
End If

--
Good Luck
BS"D


Damo G said:
Hi team,

Have scoured all of the posts and tried several different things for days
but just can't seem to nut this one out.

I have a form (FrmSeedBankStockAvailable) in datasheet view that lists seed
lots by BatchID. I want to be able to double click on the record selector
for a particular batch and have a form (DialogSeedBankWithdrawal) open so
that I can make a new withdrawal entry, with the BatchID already entered from
the selected record. I know that to do this I need to use the forms'
DblClick property. I have been using the following code (and tried
variations of from other posts).

DoCmd.OpenForm "DialogSeedBankWithdrawal", , , "[BatchID] = " & Me!BatchID,
acFormAdd

Some of the time I just get a blank form, and other times when I got the
code close it would ask for the paratmeter but the particular batch ID would
be in the pop up. I know it is probably something very simple.

Thanks in advance for anyone who can help.

Damo G
 
O

Ofer Cohen

Sorry, wrong order


DoCmd.OpenForm "DialogSeedBankWithdrawal", , , ,acFormAdd , , Me.BatchID

Good Luck
BS"D

Damo G said:
Thanks for the quick response Ofer.

I cut and pasted your code. Upon execution the DialogSeedBankWithdrawal
form did open, but it didn't create a new entry and just listed all of the
withdrawal records none of which matched the BatchID. Do I need to change
the properties of the DialogSeedBankWithdrawal form or is there a bit missing
from the code?

Thanks and regards,

Damo G

Ofer Cohen said:
There is no much point on openning the form with a criteria (WhereCondition)
if you open the form with acFormAdd, which mean open the form for data input
only.

Instead open the form without a criteria, and pass the Me!BatchID to the
next form using the OpenArgs

DoCmd.OpenForm "DialogSeedBankWithdrawal", , , , , , Me.BatchID

On the OnLoad event of the DialogSeedBankWithdrawal form write the code

If Me.NewRecord And Not IsNull(Me.OpenArgs) Then
Me.BatchID = Me.OpenArgs
End If

--
Good Luck
BS"D


Damo G said:
Hi team,

Have scoured all of the posts and tried several different things for days
but just can't seem to nut this one out.

I have a form (FrmSeedBankStockAvailable) in datasheet view that lists seed
lots by BatchID. I want to be able to double click on the record selector
for a particular batch and have a form (DialogSeedBankWithdrawal) open so
that I can make a new withdrawal entry, with the BatchID already entered from
the selected record. I know that to do this I need to use the forms'
DblClick property. I have been using the following code (and tried
variations of from other posts).

DoCmd.OpenForm "DialogSeedBankWithdrawal", , , "[BatchID] = " & Me!BatchID,
acFormAdd

Some of the time I just get a blank form, and other times when I got the
code close it would ask for the paratmeter but the particular batch ID would
be in the pop up. I know it is probably something very simple.

Thanks in advance for anyone who can help.

Damo G
 
G

Guest

Thanks Ofer,

With my limited knowledge I anticipated it was missing before you replied so
I tried that and it still didn't work. Your response though has proved that
I was right and the problem must have lain elsewhere. I went back to the
DialogSeedBankWithdrawal and had a look at all of my settings. I eventually
discovered where my problem lay. My forms record source related to a query
that contained only the fields from the Withdrawal table. For some reason
(which I investigated but couldn't acertain - perhaps you can help) when I
open the query it won't allow new entries. I changed the record source to
the Withdrawal table and now everything works as it should. Wouldn't have
been able to sort this one out without you.

Thanks again.

Damo G



Ofer Cohen said:
Sorry, wrong order


DoCmd.OpenForm "DialogSeedBankWithdrawal", , , ,acFormAdd , , Me.BatchID

Good Luck
BS"D

Damo G said:
Thanks for the quick response Ofer.

I cut and pasted your code. Upon execution the DialogSeedBankWithdrawal
form did open, but it didn't create a new entry and just listed all of the
withdrawal records none of which matched the BatchID. Do I need to change
the properties of the DialogSeedBankWithdrawal form or is there a bit missing
from the code?

Thanks and regards,

Damo G

Ofer Cohen said:
There is no much point on openning the form with a criteria (WhereCondition)
if you open the form with acFormAdd, which mean open the form for data input
only.

Instead open the form without a criteria, and pass the Me!BatchID to the
next form using the OpenArgs

DoCmd.OpenForm "DialogSeedBankWithdrawal", , , , , , Me.BatchID

On the OnLoad event of the DialogSeedBankWithdrawal form write the code

If Me.NewRecord And Not IsNull(Me.OpenArgs) Then
Me.BatchID = Me.OpenArgs
End If

--
Good Luck
BS"D


:

Hi team,

Have scoured all of the posts and tried several different things for days
but just can't seem to nut this one out.

I have a form (FrmSeedBankStockAvailable) in datasheet view that lists seed
lots by BatchID. I want to be able to double click on the record selector
for a particular batch and have a form (DialogSeedBankWithdrawal) open so
that I can make a new withdrawal entry, with the BatchID already entered from
the selected record. I know that to do this I need to use the forms'
DblClick property. I have been using the following code (and tried
variations of from other posts).

DoCmd.OpenForm "DialogSeedBankWithdrawal", , , "[BatchID] = " & Me!BatchID,
acFormAdd

Some of the time I just get a blank form, and other times when I got the
code close it would ask for the paratmeter but the particular batch ID would
be in the pop up. I know it is probably something very simple.

Thanks in advance for anyone who can help.

Damo G
 
G

Guest

Sometimes when you link few tables in a query, it doesn't allow adding or
changing records, it will prompt you with the message that this record is not
updatetable (especialy when you link two tables not by the key).

Sometimes I'm changing the UniqueProperty of the query to Yes it make it
possible to update or add records.

If that doesn't help, I'm removing tables from the query, and in the form I
use Combo's Or SubForms instead to display the desired records.

--
Good Luck
BS"D


Damo G said:
Thanks Ofer,

With my limited knowledge I anticipated it was missing before you replied so
I tried that and it still didn't work. Your response though has proved that
I was right and the problem must have lain elsewhere. I went back to the
DialogSeedBankWithdrawal and had a look at all of my settings. I eventually
discovered where my problem lay. My forms record source related to a query
that contained only the fields from the Withdrawal table. For some reason
(which I investigated but couldn't acertain - perhaps you can help) when I
open the query it won't allow new entries. I changed the record source to
the Withdrawal table and now everything works as it should. Wouldn't have
been able to sort this one out without you.

Thanks again.

Damo G



Ofer Cohen said:
Sorry, wrong order


DoCmd.OpenForm "DialogSeedBankWithdrawal", , , ,acFormAdd , , Me.BatchID

Good Luck
BS"D

Damo G said:
Thanks for the quick response Ofer.

I cut and pasted your code. Upon execution the DialogSeedBankWithdrawal
form did open, but it didn't create a new entry and just listed all of the
withdrawal records none of which matched the BatchID. Do I need to change
the properties of the DialogSeedBankWithdrawal form or is there a bit missing
from the code?

Thanks and regards,

Damo G

:

There is no much point on openning the form with a criteria (WhereCondition)
if you open the form with acFormAdd, which mean open the form for data input
only.

Instead open the form without a criteria, and pass the Me!BatchID to the
next form using the OpenArgs

DoCmd.OpenForm "DialogSeedBankWithdrawal", , , , , , Me.BatchID

On the OnLoad event of the DialogSeedBankWithdrawal form write the code

If Me.NewRecord And Not IsNull(Me.OpenArgs) Then
Me.BatchID = Me.OpenArgs
End If

--
Good Luck
BS"D


:

Hi team,

Have scoured all of the posts and tried several different things for days
but just can't seem to nut this one out.

I have a form (FrmSeedBankStockAvailable) in datasheet view that lists seed
lots by BatchID. I want to be able to double click on the record selector
for a particular batch and have a form (DialogSeedBankWithdrawal) open so
that I can make a new withdrawal entry, with the BatchID already entered from
the selected record. I know that to do this I need to use the forms'
DblClick property. I have been using the following code (and tried
variations of from other posts).

DoCmd.OpenForm "DialogSeedBankWithdrawal", , , "[BatchID] = " & Me!BatchID,
acFormAdd

Some of the time I just get a blank form, and other times when I got the
code close it would ask for the paratmeter but the particular batch ID would
be in the pop up. I know it is probably something very simple.

Thanks in advance for anyone who can help.

Damo G
 
G

Guest

The problem in that was my query related to only one table. I finally
discovered the cause by recreating the query and comparing it with my
original query. For some reason I had totals enabled for the query and it
was grouping by all of the fields. As soon as I disabled this everything
returned to normal.

Thanks once again.

Damo G

Ofer Cohen said:
Sometimes when you link few tables in a query, it doesn't allow adding or
changing records, it will prompt you with the message that this record is not
updatetable (especialy when you link two tables not by the key).

Sometimes I'm changing the UniqueProperty of the query to Yes it make it
possible to update or add records.

If that doesn't help, I'm removing tables from the query, and in the form I
use Combo's Or SubForms instead to display the desired records.

--
Good Luck
BS"D


Damo G said:
Thanks Ofer,

With my limited knowledge I anticipated it was missing before you replied so
I tried that and it still didn't work. Your response though has proved that
I was right and the problem must have lain elsewhere. I went back to the
DialogSeedBankWithdrawal and had a look at all of my settings. I eventually
discovered where my problem lay. My forms record source related to a query
that contained only the fields from the Withdrawal table. For some reason
(which I investigated but couldn't acertain - perhaps you can help) when I
open the query it won't allow new entries. I changed the record source to
the Withdrawal table and now everything works as it should. Wouldn't have
been able to sort this one out without you.

Thanks again.

Damo G



Ofer Cohen said:
Sorry, wrong order


DoCmd.OpenForm "DialogSeedBankWithdrawal", , , ,acFormAdd , , Me.BatchID

Good Luck
BS"D

Thanks for the quick response Ofer.

I cut and pasted your code. Upon execution the DialogSeedBankWithdrawal
form did open, but it didn't create a new entry and just listed all of the
withdrawal records none of which matched the BatchID. Do I need to change
the properties of the DialogSeedBankWithdrawal form or is there a bit
missing
from the code?

Thanks and regards,

Damo G

:

There is no much point on openning the form with a criteria
(WhereCondition)
if you open the form with acFormAdd, which mean open the form for data
input
only.

Instead open the form without a criteria, and pass the Me!BatchID to the
next form using the OpenArgs

DoCmd.OpenForm "DialogSeedBankWithdrawal", , , , , , Me.BatchID

On the OnLoad event of the DialogSeedBankWithdrawal form write the code

If Me.NewRecord And Not IsNull(Me.OpenArgs) Then
Me.BatchID = Me.OpenArgs
End If

--
Good Luck
BS"D


:

Hi team,

Have scoured all of the posts and tried several different things for
days
but just can't seem to nut this one out.

I have a form (FrmSeedBankStockAvailable) in datasheet view that lists
seed
lots by BatchID. I want to be able to double click on the record
selector
for a particular batch and have a form (DialogSeedBankWithdrawal) open
so
that I can make a new withdrawal entry, with the BatchID already
entered from
the selected record. I know that to do this I need to use the forms'
DblClick property. I have been using the following code (and tried
variations of from other posts).

DoCmd.OpenForm "DialogSeedBankWithdrawal", , , "[BatchID] = " &
Me!BatchID,
acFormAdd

Some of the time I just get a blank form, and other times when I got
the
code close it would ask for the paratmeter but the particular batch ID
would
be in the pop up. I know it is probably something very simple.

Thanks in advance for anyone who can help.

Damo G
 

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