OpenForm using a Query

  • Thread starter Thread starter Neil M
  • Start date Start date
N

Neil M

I have a command button on my main form that shows VIEW JOB IDI want to be
able to press this button and it opens up my normal JobDetails form using a
different query, somehting like this;DoCmd.OpenForm "JobDetails",
QUERY??whats the exact coding for this or even better i want to user to
input a job id, so the domc.dopenform command where it can ask for user
input for one of the fields.

Thanks.

Neil
 
Neil,

This isn't hard, and its something you could find out for yourself, simply
by checking either the Help file, or by using Intellisence:
DoCmd.OpenForm "frmFormName", , "qrySomeQuery"
....or...
DoCmd.OpenForm "frmFormName", , , "[somefield] = 123"

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Hi;

Started searching for information regarding opening a frm using different
qrys.

Put a smile on my face when I found that Niel M. had asked the question and
that Graham Search had answered it.

Thank You gentlemen.

Would You be so kind to supply some more information.

Created frmUnbound. Added txtControl. Control Source: FirstName
Created qryFirstName, Field: FirstName: [FirstName] (using tblClientNames)
Created qryFullName, Field: FirstName: [FirstName]&" "&[LastName] (using
tblClientNames)

Created frmCmdButtons.
cmdButton1: DoCmd.OpenForm "frmUnbound", , "qryFirstName"
cmdButton2: DoCmd.OpenForm "frmUnbound", , "qryFullName"

When the frmUnbound opens the Control displays: #Name?

Then to frmUnbound set Record Source as: tblClientNames.
The Control only displays the First Name no matter which cmdButton is used
to open the frm.

What am I missing?

Thank You.

Andy

Graham R Seach said:
Neil,

This isn't hard, and its something you could find out for yourself, simply
by checking either the Help file, or by using Intellisence:
DoCmd.OpenForm "frmFormName", , "qrySomeQuery"
...or...
DoCmd.OpenForm "frmFormName", , , "[somefield] = 123"

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Neil M said:
I have a command button on my main form that shows VIEW JOB IDI want to be
able to press this button and it opens up my normal JobDetails form using
a
different query, somehting like this;DoCmd.OpenForm "JobDetails",
QUERY??whats the exact coding for this or even better i want to user to
input a job id, so the domc.dopenform command where it can ask for user
input for one of the fields.

Thanks.

Neil
 
Andy,

I don't think you quite understand the purpose of the Filter argument. The
form still needs to be bound. The Filter argument simply applies a filter to
the existing form RecordSource. It's equivalent to setting the form's Filter
property.

If you want to dynamically assign a RecordSource after the unbound form
loads:
DoCmd.OpenForm "frmCustomer"
Forms!frmCustomer.RecordSource = "qryCustomer"

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Andy said:
Hi;

Started searching for information regarding opening a frm using different
qrys.

Put a smile on my face when I found that Niel M. had asked the question
and
that Graham Search had answered it.

Thank You gentlemen.

Would You be so kind to supply some more information.

Created frmUnbound. Added txtControl. Control Source: FirstName
Created qryFirstName, Field: FirstName: [FirstName] (using
tblClientNames)
Created qryFullName, Field: FirstName: [FirstName]&" "&[LastName] (using
tblClientNames)

Created frmCmdButtons.
cmdButton1: DoCmd.OpenForm "frmUnbound", , "qryFirstName"
cmdButton2: DoCmd.OpenForm "frmUnbound", , "qryFullName"

When the frmUnbound opens the Control displays: #Name?

Then to frmUnbound set Record Source as: tblClientNames.
The Control only displays the First Name no matter which cmdButton is used
to open the frm.

What am I missing?

Thank You.

Andy

Graham R Seach said:
Neil,

This isn't hard, and its something you could find out for yourself,
simply
by checking either the Help file, or by using Intellisence:
DoCmd.OpenForm "frmFormName", , "qrySomeQuery"
...or...
DoCmd.OpenForm "frmFormName", , , "[somefield] = 123"

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Neil M said:
I have a command button on my main form that shows VIEW JOB IDI want to be
able to press this button and it opens up my normal JobDetails form using
a
different query, somehting like this;DoCmd.OpenForm "JobDetails",
QUERY??whats the exact coding for this or even better i want to user to
input a job id, so the domc.dopenform command where it can ask for user
input for one of the fields.

Thanks.

Neil
 
Graham;

You always put a smile on my face.

Thank You.

Andy

Graham R Seach said:
Andy,

I don't think you quite understand the purpose of the Filter argument. The
form still needs to be bound. The Filter argument simply applies a filter to
the existing form RecordSource. It's equivalent to setting the form's Filter
property.

If you want to dynamically assign a RecordSource after the unbound form
loads:
DoCmd.OpenForm "frmCustomer"
Forms!frmCustomer.RecordSource = "qryCustomer"

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Andy said:
Hi;

Started searching for information regarding opening a frm using different
qrys.

Put a smile on my face when I found that Niel M. had asked the question
and
that Graham Search had answered it.

Thank You gentlemen.

Would You be so kind to supply some more information.

Created frmUnbound. Added txtControl. Control Source: FirstName
Created qryFirstName, Field: FirstName: [FirstName] (using
tblClientNames)
Created qryFullName, Field: FirstName: [FirstName]&" "&[LastName] (using
tblClientNames)

Created frmCmdButtons.
cmdButton1: DoCmd.OpenForm "frmUnbound", , "qryFirstName"
cmdButton2: DoCmd.OpenForm "frmUnbound", , "qryFullName"

When the frmUnbound opens the Control displays: #Name?

Then to frmUnbound set Record Source as: tblClientNames.
The Control only displays the First Name no matter which cmdButton is used
to open the frm.

What am I missing?

Thank You.

Andy

Graham R Seach said:
Neil,

This isn't hard, and its something you could find out for yourself,
simply
by checking either the Help file, or by using Intellisence:
DoCmd.OpenForm "frmFormName", , "qrySomeQuery"
...or...
DoCmd.OpenForm "frmFormName", , , "[somefield] = 123"

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
to
be
able to press this button and it opens up my normal JobDetails form using
a
different query, somehting like this;DoCmd.OpenForm "JobDetails",
QUERY??whats the exact coding for this or even better i want to user to
input a job id, so the domc.dopenform command where it can ask for user
input for one of the fields.

Thanks.

Neil
 
<<You always put a smile on my face.>>
That's a worry. :-)

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Andy said:
Graham;

You always put a smile on my face.

Thank You.

Andy

Graham R Seach said:
Andy,

I don't think you quite understand the purpose of the Filter argument.
The
form still needs to be bound. The Filter argument simply applies a filter to
the existing form RecordSource. It's equivalent to setting the form's Filter
property.

If you want to dynamically assign a RecordSource after the unbound form
loads:
DoCmd.OpenForm "frmCustomer"
Forms!frmCustomer.RecordSource = "qryCustomer"

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Andy said:
Hi;

Started searching for information regarding opening a frm using different
qrys.

Put a smile on my face when I found that Niel M. had asked the question
and
that Graham Search had answered it.

Thank You gentlemen.

Would You be so kind to supply some more information.

Created frmUnbound. Added txtControl. Control Source: FirstName
Created qryFirstName, Field: FirstName: [FirstName] (using
tblClientNames)
Created qryFullName, Field: FirstName: [FirstName]&" "&[LastName]
(using
tblClientNames)

Created frmCmdButtons.
cmdButton1: DoCmd.OpenForm "frmUnbound", , "qryFirstName"
cmdButton2: DoCmd.OpenForm "frmUnbound", , "qryFullName"

When the frmUnbound opens the Control displays: #Name?

Then to frmUnbound set Record Source as: tblClientNames.
The Control only displays the First Name no matter which cmdButton is used
to open the frm.

What am I missing?

Thank You.

Andy

Neil,

This isn't hard, and its something you could find out for yourself,
simply
by checking either the Help file, or by using Intellisence:
DoCmd.OpenForm "frmFormName", , "qrySomeQuery"
...or...
DoCmd.OpenForm "frmFormName", , , "[somefield] = 123"

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

I have a command button on my main form that shows VIEW JOB IDI want to
be
able to press this button and it opens up my normal JobDetails form
using
a
different query, somehting like this;DoCmd.OpenForm "JobDetails",
QUERY??whats the exact coding for this or even better i want to user to
input a job id, so the domc.dopenform command where it can ask for user
input for one of the fields.

Thanks.

Neil
 
Just couldn't resist, huh!

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------
 
Back
Top