subform problem

G

Guest

I have two problems with my main form and subforms:

1. I have a continuous subform and a main form with comboboxes and with
Link Child Fields - [Accountable] , Link Master Fields - [cboUserName] having
the Table1 as a data source. Everything is working perfectly.
If I choose a username from the cboUserName the subform shows the data. But,
when I assign a value to the cboUserName programmatically
Me.cboUserName.Requery
Me.cboUserName = somename on the main Form load event the subform doesn't
show enything.

2. I have another comboboxe and textboxes (cboCode and txtDate1 and
txtDate2) on the Main Form and I'd like to filter data using them too. The
cboCode and cboUserName should filter the data independently however the
dates should filter the data in conjunction with eather cboCode or
cboUserName. The cboCode can filter data by Code or to show all data
(choosing "ALL"), or show part of the data (choosing "All Departments").
I've created a query that can do all those types of filtering. As a query
it's working very well with all those combinations of choosing different
comboboxes and dates on a main form. But, when I'm trying to use this query
as a data source for my subform without any child or master fields the
subform shows nothing. I've added Forms!MainForm!subform.requery on the
combobox afterupdate event but it doesn't help too.

Can anybody advise how I could handle with all this?

Thanks
 
G

Guest

It looks like I partly resolved it.
I'm using just one continuous form with comboboxes for filtering in the form
header iI don't need the main and subform as I'm using the one table to
filter.
Then I'm using a query as a data source.
Everything is fine - the cboCode filtering is always owrking well but
cboUserName is not always working properly. Wnen I'm switching from cboCode
to cboUserName it's working well but when I'm filtering inside cboUserName
for several times ispecialy after choosing the name for which the data
doesn't exist the filtering is not working.
When I'm switching from one cbobox another one is assigned Null. I'm using
Me.Requery for the both of comboboxes in the afterupdate event.
Could anybody look at this query and help me on it?

Here is my query:
SELECT tblInitiatives.ID, tblInitiatives.Code, tblInitiatives.Accountable,
tblInitiatives.InID, tblInitiatives.Responsible, tblInitiatives.Impact,
tblInitiatives.Deliverables, tblInitiatives.[Action Items],
tblInitiatives.[Completion Date], tblInitiatives.Completed,
tblInitiatives.StratInitiative, tblInitiatives.Notes
FROM tblInitiatives
WHERE
(((tblInitiatives.Code)=IIf([Forms]![frmInitiatives_Base]![cboCode]="ALL",
Code:
,IIf([Forms]![frmInitiatives_Base]![cboCode]="All
Departments",[Code],IIf([Forms]![frmInitiatives_Base]![cboCode]="All
Strat.Initiatives",[Code],IIf(IsNull([Forms]![frmInitiatives_Base]![cboCode]),[Code],[Forms]![frmInitiatives_Base]![cboCode])))))
AND
((tblInitiatives.Accountable)=IIf(IsNull([Forms]![frmInitiatives_Base]![cboUserName]),[Accountable],[Forms]![frmInitiatives_Base]![cboUserName]))
AND
((tblInitiatives.StratInitiative)=IIf([Forms]![frmInitiatives_Base]![cboCode]="ALL",[StratInitiative],IIf([Forms]![frmInitiatives_Base]![cboCode]="All
Strat.Initiatives",-1,IIf([Forms]![frmInitiatives_Base]![cboCode]="All
Departments",0,[StratInitiative])))))
ORDER BY tblInitiatives.Code, tblInitiatives.[Completion Date];

Thanks

[QUOTE="Alex"]
I have two problems with my main form and subforms:

1. I have a continuous subform and a main form with comboboxes and with
Link Child Fields - [Accountable] , Link Master Fields - [cboUserName] having
the Table1 as a data source. Everything is working perfectly.
If I choose a username from the cboUserName the subform shows the data. But,
when I assign a value to the cboUserName programmatically
Me.cboUserName.Requery
Me.cboUserName = somename on the main Form load event the subform doesn't
show enything.

2. I have another comboboxe and textboxes (cboCode and txtDate1 and
txtDate2) on the Main Form and I'd like to filter data using them too. The
cboCode and cboUserName should filter the data independently however the
dates should filter the data in conjunction with eather cboCode or
cboUserName. The cboCode can filter data by Code or to show all data
(choosing "ALL"), or show part of the data (choosing "All Departments").
I've created a query that can do all those types of filtering. As a query
it's working very well with all those combinations of choosing different
comboboxes and dates on a main form. But, when I'm trying to use this query
as a data source for my subform without any child or master fields the
subform shows nothing. I've added Forms!MainForm!subform.requery on the
combobox afterupdate event but it doesn't help too.

Can anybody advise how I could handle with all this?

Thanks
[/QUOTE]
 
G

Guest

It has been resolved as well.

It was a mistake in the afterupdate event code.

There is just one unresolved issue - when I'm downloading the form
assingning someusername to the cboUserName there is no data in the continuous
form. Only, when I choose the username from the combobox the data appeares.

Any thoughts on it?

Thanks

Alex said:
It looks like I partly resolved it.
I'm using just one continuous form with comboboxes for filtering in the form
header iI don't need the main and subform as I'm using the one table to
filter.
Then I'm using a query as a data source.
Everything is fine - the cboCode filtering is always owrking well but
cboUserName is not always working properly. Wnen I'm switching from cboCode
to cboUserName it's working well but when I'm filtering inside cboUserName
for several times ispecialy after choosing the name for which the data
doesn't exist the filtering is not working.
When I'm switching from one cbobox another one is assigned Null. I'm using
Me.Requery for the both of comboboxes in the afterupdate event.
Could anybody look at this query and help me on it?

Here is my query:
SELECT tblInitiatives.ID, tblInitiatives.Code, tblInitiatives.Accountable,
tblInitiatives.InID, tblInitiatives.Responsible, tblInitiatives.Impact,
tblInitiatives.Deliverables, tblInitiatives.[Action Items],
tblInitiatives.[Completion Date], tblInitiatives.Completed,
tblInitiatives.StratInitiative, tblInitiatives.Notes
FROM tblInitiatives
WHERE
(((tblInitiatives.Code)=IIf([Forms]![frmInitiatives_Base]![cboCode]="ALL",
Code:
,IIf([Forms]![frmInitiatives_Base]![cboCode]="All
Departments",[Code],IIf([Forms]![frmInitiatives_Base]![cboCode]="All
Strat.Initiatives",[Code],IIf(IsNull([Forms]![frmInitiatives_Base]![cboCode]),[Code],[Forms]![frmInitiatives_Base]![cboCode])))))
AND
((tblInitiatives.Accountable)=IIf(IsNull([Forms]![frmInitiatives_Base]![cboUserName]),[Accountable],[Forms]![frmInitiatives_Base]![cboUserName]))
AND
((tblInitiatives.StratInitiative)=IIf([Forms]![frmInitiatives_Base]![cboCode]="ALL",[StratInitiative],IIf([Forms]![frmInitiatives_Base]![cboCode]="All
Strat.Initiatives",-1,IIf([Forms]![frmInitiatives_Base]![cboCode]="All
Departments",0,[StratInitiative])))))
ORDER BY tblInitiatives.Code, tblInitiatives.[Completion Date];

Thanks

[QUOTE="Alex"]
I have two problems with my main form and subforms:

1. I have a continuous subform and a main form with comboboxes and with
Link Child Fields - [Accountable] , Link Master Fields - [cboUserName] having
the Table1 as a data source. Everything is working perfectly.
If I choose a username from the cboUserName the subform shows the data. But,
when I assign a value to the cboUserName programmatically
Me.cboUserName.Requery
Me.cboUserName = somename on the main Form load event the subform doesn't
show enything.

2. I have another comboboxe and textboxes (cboCode and txtDate1 and
txtDate2) on the Main Form and I'd like to filter data using them too. The
cboCode and cboUserName should filter the data independently however the
dates should filter the data in conjunction with eather cboCode or
cboUserName. The cboCode can filter data by Code or to show all data
(choosing "ALL"), or show part of the data (choosing "All Departments").
I've created a query that can do all those types of filtering. As a query
it's working very well with all those combinations of choosing different
comboboxes and dates on a main form. But, when I'm trying to use this query
as a data source for my subform without any child or master fields the
subform shows nothing. I've added Forms!MainForm!subform.requery on the
combobox afterupdate event but it doesn't help too.

Can anybody advise how I could handle with all this?

Thanks
[/QUOTE][/QUOTE]
 

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