First field is left blank in combo box

K

Kelly

I have searched for this and could'nt find the answer I'm in need of, so here
is my question.
I'm using Access 2007 and have a combo box referencing a query. The correct
result is showing up in the combo box, but the first "row" is blank. I need
the combo box first row to show the results.

If I run the query that it's referencing, there is no blank first row.

Example of row source;
SELECT [q_UserAvgId1].[UserID], [q_UserAvgId1].[UserName],
[q_UserAvgId1].[AvgOfTotal_Hours] FROM [q_UserAvgId1] ORDER BY [UserName];

Thanks,
 
D

Douglas J. Steele

Is the combo box bound to a field in the form's RecordSource? An unbound
combo box, by default, doesn't show any data.

If it is unbound and you need to make it select the first value, the
following code will do it:

Me.Combo0 = Me.Combo0.ItemData(0)

Replace "Combo0" with the actual name of your combo box.

This code can go in the form's Load event.
 
K

Kelly

Yes, it is an unbound combo box. I will use your code to fix this.

Thank you very much for the quick answer to my problem.

Douglas J. Steele said:
Is the combo box bound to a field in the form's RecordSource? An unbound
combo box, by default, doesn't show any data.

If it is unbound and you need to make it select the first value, the
following code will do it:

Me.Combo0 = Me.Combo0.ItemData(0)

Replace "Combo0" with the actual name of your combo box.

This code can go in the form's Load event.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kelly said:
I have searched for this and could'nt find the answer I'm in need of, so
here
is my question.
I'm using Access 2007 and have a combo box referencing a query. The
correct
result is showing up in the combo box, but the first "row" is blank. I
need
the combo box first row to show the results.

If I run the query that it's referencing, there is no blank first row.

Example of row source;
SELECT [q_UserAvgId1].[UserID], [q_UserAvgId1].[UserName],
[q_UserAvgId1].[AvgOfTotal_Hours] FROM [q_UserAvgId1] ORDER BY [UserName];

Thanks,
 
D

Douglas J. Steele

I should have mentioned that if you sometimes turn the column headers on,
you'll need to use

Me.Combo0 = Me.Combo0.ItemData(IIf(Me.Combo0.ColumnHeads, 1, 0))

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kelly said:
Yes, it is an unbound combo box. I will use your code to fix this.

Thank you very much for the quick answer to my problem.

Douglas J. Steele said:
Is the combo box bound to a field in the form's RecordSource? An unbound
combo box, by default, doesn't show any data.

If it is unbound and you need to make it select the first value, the
following code will do it:

Me.Combo0 = Me.Combo0.ItemData(0)

Replace "Combo0" with the actual name of your combo box.

This code can go in the form's Load event.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kelly said:
I have searched for this and could'nt find the answer I'm in need of, so
here
is my question.
I'm using Access 2007 and have a combo box referencing a query. The
correct
result is showing up in the combo box, but the first "row" is blank. I
need
the combo box first row to show the results.

If I run the query that it's referencing, there is no blank first row.

Example of row source;
SELECT [q_UserAvgId1].[UserID], [q_UserAvgId1].[UserName],
[q_UserAvgId1].[AvgOfTotal_Hours] FROM [q_UserAvgId1] ORDER BY
[UserName];

Thanks,
 
K

Kelly

I placed this in the forms event "on Load" Me.cboAvg1 = Me.cboAvg1.ItemData(0)

When I reload the form, I get this message;

Microsoft cannot find the object Me

Do I need to add something to the Visual basic Library MQL?

Thanks,

Douglas J. Steele said:
Is the combo box bound to a field in the form's RecordSource? An unbound
combo box, by default, doesn't show any data.

If it is unbound and you need to make it select the first value, the
following code will do it:

Me.Combo0 = Me.Combo0.ItemData(0)

Replace "Combo0" with the actual name of your combo box.

This code can go in the form's Load event.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kelly said:
I have searched for this and could'nt find the answer I'm in need of, so
here
is my question.
I'm using Access 2007 and have a combo box referencing a query. The
correct
result is showing up in the combo box, but the first "row" is blank. I
need
the combo box first row to show the results.

If I run the query that it's referencing, there is no blank first row.

Example of row source;
SELECT [q_UserAvgId1].[UserID], [q_UserAvgId1].[UserName],
[q_UserAvgId1].[AvgOfTotal_Hours] FROM [q_UserAvgId1] ORDER BY [UserName];

Thanks,
 
D

Douglas J. Steele

You need to use VBA.

Set the property to [Event Procedure], then click on the ellipsis (...) to
the right of the property. That should take you into the VB Editor, in the
middle of text like

Private Sub Form_Load

End Sub

Put that line of code in between those two lines.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kelly said:
I placed this in the forms event "on Load" Me.cboAvg1 =
Me.cboAvg1.ItemData(0)

When I reload the form, I get this message;

Microsoft cannot find the object Me

Do I need to add something to the Visual basic Library MQL?

Thanks,

Douglas J. Steele said:
Is the combo box bound to a field in the form's RecordSource? An unbound
combo box, by default, doesn't show any data.

If it is unbound and you need to make it select the first value, the
following code will do it:

Me.Combo0 = Me.Combo0.ItemData(0)

Replace "Combo0" with the actual name of your combo box.

This code can go in the form's Load event.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kelly said:
I have searched for this and could'nt find the answer I'm in need of, so
here
is my question.
I'm using Access 2007 and have a combo box referencing a query. The
correct
result is showing up in the combo box, but the first "row" is blank. I
need
the combo box first row to show the results.

If I run the query that it's referencing, there is no blank first row.

Example of row source;
SELECT [q_UserAvgId1].[UserID], [q_UserAvgId1].[UserName],
[q_UserAvgId1].[AvgOfTotal_Hours] FROM [q_UserAvgId1] ORDER BY
[UserName];

Thanks,
 
K

Kelly

Douglas, no column headers are being shown

Douglas J. Steele said:
I should have mentioned that if you sometimes turn the column headers on,
you'll need to use

Me.Combo0 = Me.Combo0.ItemData(IIf(Me.Combo0.ColumnHeads, 1, 0))

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kelly said:
Yes, it is an unbound combo box. I will use your code to fix this.

Thank you very much for the quick answer to my problem.

Douglas J. Steele said:
Is the combo box bound to a field in the form's RecordSource? An unbound
combo box, by default, doesn't show any data.

If it is unbound and you need to make it select the first value, the
following code will do it:

Me.Combo0 = Me.Combo0.ItemData(0)

Replace "Combo0" with the actual name of your combo box.

This code can go in the form's Load event.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I have searched for this and could'nt find the answer I'm in need of, so
here
is my question.
I'm using Access 2007 and have a combo box referencing a query. The
correct
result is showing up in the combo box, but the first "row" is blank. I
need
the combo box first row to show the results.

If I run the query that it's referencing, there is no blank first row.

Example of row source;
SELECT [q_UserAvgId1].[UserID], [q_UserAvgId1].[UserName],
[q_UserAvgId1].[AvgOfTotal_Hours] FROM [q_UserAvgId1] ORDER BY
[UserName];

Thanks,
 
K

Kelly

That worked Perfect! You're brilliant

Thank you!!!

Douglas J. Steele said:
You need to use VBA.

Set the property to [Event Procedure], then click on the ellipsis (...) to
the right of the property. That should take you into the VB Editor, in the
middle of text like

Private Sub Form_Load

End Sub

Put that line of code in between those two lines.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kelly said:
I placed this in the forms event "on Load" Me.cboAvg1 =
Me.cboAvg1.ItemData(0)

When I reload the form, I get this message;

Microsoft cannot find the object Me

Do I need to add something to the Visual basic Library MQL?

Thanks,

Douglas J. Steele said:
Is the combo box bound to a field in the form's RecordSource? An unbound
combo box, by default, doesn't show any data.

If it is unbound and you need to make it select the first value, the
following code will do it:

Me.Combo0 = Me.Combo0.ItemData(0)

Replace "Combo0" with the actual name of your combo box.

This code can go in the form's Load event.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I have searched for this and could'nt find the answer I'm in need of, so
here
is my question.
I'm using Access 2007 and have a combo box referencing a query. The
correct
result is showing up in the combo box, but the first "row" is blank. I
need
the combo box first row to show the results.

If I run the query that it's referencing, there is no blank first row.

Example of row source;
SELECT [q_UserAvgId1].[UserID], [q_UserAvgId1].[UserName],
[q_UserAvgId1].[AvgOfTotal_Hours] FROM [q_UserAvgId1] ORDER BY
[UserName];

Thanks,
 
K

Kelly

How would I add multiple instances (different Id) to the form load event?
I have a few users I'm calc. job time against. Can I place similair lines of
code in the vba?

Thank you so much! I've been struggling with this total time display for a
bit. It takes quite, a bit at least fora beginner, to get the accurate
workdays, hrs, min, and all that good stuff.
Now I can move on to more good stuff...
Thank you,

Douglas J. Steele said:
You need to use VBA.

Set the property to [Event Procedure], then click on the ellipsis (...) to
the right of the property. That should take you into the VB Editor, in the
middle of text like

Private Sub Form_Load

End Sub

Put that line of code in between those two lines.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kelly said:
I placed this in the forms event "on Load" Me.cboAvg1 =
Me.cboAvg1.ItemData(0)

When I reload the form, I get this message;

Microsoft cannot find the object Me

Do I need to add something to the Visual basic Library MQL?

Thanks,

Douglas J. Steele said:
Is the combo box bound to a field in the form's RecordSource? An unbound
combo box, by default, doesn't show any data.

If it is unbound and you need to make it select the first value, the
following code will do it:

Me.Combo0 = Me.Combo0.ItemData(0)

Replace "Combo0" with the actual name of your combo box.

This code can go in the form's Load event.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I have searched for this and could'nt find the answer I'm in need of, so
here
is my question.
I'm using Access 2007 and have a combo box referencing a query. The
correct
result is showing up in the combo box, but the first "row" is blank. I
need
the combo box first row to show the results.

If I run the query that it's referencing, there is no blank first row.

Example of row source;
SELECT [q_UserAvgId1].[UserID], [q_UserAvgId1].[UserName],
[q_UserAvgId1].[AvgOfTotal_Hours] FROM [q_UserAvgId1] ORDER BY
[UserName];

Thanks,
 
D

Douglas J. Steele

Sorry, you'll have to give some more details. I don't understand what you're
trying to do.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Kelly said:
How would I add multiple instances (different Id) to the form load event?
I have a few users I'm calc. job time against. Can I place similair lines
of
code in the vba?

Thank you so much! I've been struggling with this total time display for a
bit. It takes quite, a bit at least fora beginner, to get the accurate
workdays, hrs, min, and all that good stuff.
Now I can move on to more good stuff...
Thank you,

Douglas J. Steele said:
You need to use VBA.

Set the property to [Event Procedure], then click on the ellipsis (...)
to
the right of the property. That should take you into the VB Editor, in
the
middle of text like

Private Sub Form_Load

End Sub

Put that line of code in between those two lines.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kelly said:
I placed this in the forms event "on Load" Me.cboAvg1 =
Me.cboAvg1.ItemData(0)

When I reload the form, I get this message;

Microsoft cannot find the object Me

Do I need to add something to the Visual basic Library MQL?

Thanks,

:

Is the combo box bound to a field in the form's RecordSource? An
unbound
combo box, by default, doesn't show any data.

If it is unbound and you need to make it select the first value, the
following code will do it:

Me.Combo0 = Me.Combo0.ItemData(0)

Replace "Combo0" with the actual name of your combo box.

This code can go in the form's Load event.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I have searched for this and could'nt find the answer I'm in need of,
so
here
is my question.
I'm using Access 2007 and have a combo box referencing a query. The
correct
result is showing up in the combo box, but the first "row" is blank.
I
need
the combo box first row to show the results.

If I run the query that it's referencing, there is no blank first
row.

Example of row source;
SELECT [q_UserAvgId1].[UserID], [q_UserAvgId1].[UserName],
[q_UserAvgId1].[AvgOfTotal_Hours] FROM [q_UserAvgId1] ORDER BY
[UserName];

Thanks,
 
K

Kelly

I currently working on a db for entering information based on a quote system.
On the form I need to display some averages for user performance.

I need to display the usernames and the average 'hour" value for total
completed jobs. I have the correct time value being calculated by using
Brent's code and then seperatly calculating the hours and minutes.

I'm then calculating the average of the total for the users based on the
UserId.

The query I have and need to display for all the users is;

Username Average
Joe Smith 9.7
Jim Johns 7
Sue reynolds 8.2

I won't be displaying field descriptions, just the name & average. Your help
made the first item display perfect. I would like to use the combo box to
display these records.

Here is the query data for one user;

SELECT t.UserID, t_User.UserName, Avg(t.Total_Hours) AS AvgOfTotal_Hours
FROM q_TotalWorkTime AS t INNER JOIN t_User ON t.UserID = t_User.UserID
GROUP BY t.UserID, t_User.UserName
HAVING (((t.UserID)=1));

Thanks so much!

Douglas J. Steele said:
Sorry, you'll have to give some more details. I don't understand what you're
trying to do.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Kelly said:
How would I add multiple instances (different Id) to the form load event?
I have a few users I'm calc. job time against. Can I place similair lines
of
code in the vba?

Thank you so much! I've been struggling with this total time display for a
bit. It takes quite, a bit at least fora beginner, to get the accurate
workdays, hrs, min, and all that good stuff.
Now I can move on to more good stuff...
Thank you,

Douglas J. Steele said:
You need to use VBA.

Set the property to [Event Procedure], then click on the ellipsis (...)
to
the right of the property. That should take you into the VB Editor, in
the
middle of text like

Private Sub Form_Load

End Sub

Put that line of code in between those two lines.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I placed this in the forms event "on Load" Me.cboAvg1 =
Me.cboAvg1.ItemData(0)

When I reload the form, I get this message;

Microsoft cannot find the object Me

Do I need to add something to the Visual basic Library MQL?

Thanks,

:

Is the combo box bound to a field in the form's RecordSource? An
unbound
combo box, by default, doesn't show any data.

If it is unbound and you need to make it select the first value, the
following code will do it:

Me.Combo0 = Me.Combo0.ItemData(0)

Replace "Combo0" with the actual name of your combo box.

This code can go in the form's Load event.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I have searched for this and could'nt find the answer I'm in need of,
so
here
is my question.
I'm using Access 2007 and have a combo box referencing a query. The
correct
result is showing up in the combo box, but the first "row" is blank.
I
need
the combo box first row to show the results.

If I run the query that it's referencing, there is no blank first
row.

Example of row source;
SELECT [q_UserAvgId1].[UserID], [q_UserAvgId1].[UserName],
[q_UserAvgId1].[AvgOfTotal_Hours] FROM [q_UserAvgId1] ORDER BY
[UserName];

Thanks,
 
K

Kelly

Maybe a List box would be appropriate for this case? I'll give that a try and
see if I get the desired output.

Thanks again,

Douglas J. Steele said:
Sorry, you'll have to give some more details. I don't understand what you're
trying to do.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Kelly said:
How would I add multiple instances (different Id) to the form load event?
I have a few users I'm calc. job time against. Can I place similair lines
of
code in the vba?

Thank you so much! I've been struggling with this total time display for a
bit. It takes quite, a bit at least fora beginner, to get the accurate
workdays, hrs, min, and all that good stuff.
Now I can move on to more good stuff...
Thank you,

Douglas J. Steele said:
You need to use VBA.

Set the property to [Event Procedure], then click on the ellipsis (...)
to
the right of the property. That should take you into the VB Editor, in
the
middle of text like

Private Sub Form_Load

End Sub

Put that line of code in between those two lines.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I placed this in the forms event "on Load" Me.cboAvg1 =
Me.cboAvg1.ItemData(0)

When I reload the form, I get this message;

Microsoft cannot find the object Me

Do I need to add something to the Visual basic Library MQL?

Thanks,

:

Is the combo box bound to a field in the form's RecordSource? An
unbound
combo box, by default, doesn't show any data.

If it is unbound and you need to make it select the first value, the
following code will do it:

Me.Combo0 = Me.Combo0.ItemData(0)

Replace "Combo0" with the actual name of your combo box.

This code can go in the form's Load event.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I have searched for this and could'nt find the answer I'm in need of,
so
here
is my question.
I'm using Access 2007 and have a combo box referencing a query. The
correct
result is showing up in the combo box, but the first "row" is blank.
I
need
the combo box first row to show the results.

If I run the query that it's referencing, there is no blank first
row.

Example of row source;
SELECT [q_UserAvgId1].[UserID], [q_UserAvgId1].[UserName],
[q_UserAvgId1].[AvgOfTotal_Hours] FROM [q_UserAvgId1] ORDER BY
[UserName];

Thanks,
 
D

Douglas J. Steele

I don't understand the point of the combo box (nor why a list box would be
applicable either). The purpose of those controls is allow you to choose
from a list of possible values. Is that what you're going, or are you simply
trying to show a number of values on your form? If the latter, perhaps you
should use a subform, with that SQL being the RecordSource for the form
being used as a subform.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kelly said:
I currently working on a db for entering information based on a quote
system.
On the form I need to display some averages for user performance.

I need to display the usernames and the average 'hour" value for total
completed jobs. I have the correct time value being calculated by using
Brent's code and then seperatly calculating the hours and minutes.

I'm then calculating the average of the total for the users based on the
UserId.

The query I have and need to display for all the users is;

Username Average
Joe Smith 9.7
Jim Johns 7
Sue reynolds 8.2

I won't be displaying field descriptions, just the name & average. Your
help
made the first item display perfect. I would like to use the combo box to
display these records.

Here is the query data for one user;

SELECT t.UserID, t_User.UserName, Avg(t.Total_Hours) AS AvgOfTotal_Hours
FROM q_TotalWorkTime AS t INNER JOIN t_User ON t.UserID = t_User.UserID
GROUP BY t.UserID, t_User.UserName
HAVING (((t.UserID)=1));

Thanks so much!

Douglas J. Steele said:
Sorry, you'll have to give some more details. I don't understand what
you're
trying to do.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Kelly said:
How would I add multiple instances (different Id) to the form load
event?
I have a few users I'm calc. job time against. Can I place similair
lines
of
code in the vba?

Thank you so much! I've been struggling with this total time display
for a
bit. It takes quite, a bit at least fora beginner, to get the accurate
workdays, hrs, min, and all that good stuff.
Now I can move on to more good stuff...
Thank you,

:

You need to use VBA.

Set the property to [Event Procedure], then click on the ellipsis
(...)
to
the right of the property. That should take you into the VB Editor, in
the
middle of text like

Private Sub Form_Load

End Sub

Put that line of code in between those two lines.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I placed this in the forms event "on Load" Me.cboAvg1 =
Me.cboAvg1.ItemData(0)

When I reload the form, I get this message;

Microsoft cannot find the object Me

Do I need to add something to the Visual basic Library MQL?

Thanks,

:

Is the combo box bound to a field in the form's RecordSource? An
unbound
combo box, by default, doesn't show any data.

If it is unbound and you need to make it select the first value,
the
following code will do it:

Me.Combo0 = Me.Combo0.ItemData(0)

Replace "Combo0" with the actual name of your combo box.

This code can go in the form's Load event.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I have searched for this and could'nt find the answer I'm in need
of,
so
here
is my question.
I'm using Access 2007 and have a combo box referencing a query.
The
correct
result is showing up in the combo box, but the first "row" is
blank.
I
need
the combo box first row to show the results.

If I run the query that it's referencing, there is no blank first
row.

Example of row source;
SELECT [q_UserAvgId1].[UserID], [q_UserAvgId1].[UserName],
[q_UserAvgId1].[AvgOfTotal_Hours] FROM [q_UserAvgId1] ORDER BY
[UserName];

Thanks,
 
K

Kelly

Correct, I'm just trying to show the values on the form. The way I currently
have the (1) value shown using your example of the Form Load Event, is with a
text box referencing the combo box with the control source as;
=Format([cboAvg1].[column](2),"0.##") & " hours"

The reason I have it this way is just for a better look (without a table or
form view). Maybe I can manipulate a subform to give me a desired look?

Thank you,

Douglas J. Steele said:
I don't understand the point of the combo box (nor why a list box would be
applicable either). The purpose of those controls is allow you to choose
from a list of possible values. Is that what you're going, or are you simply
trying to show a number of values on your form? If the latter, perhaps you
should use a subform, with that SQL being the RecordSource for the form
being used as a subform.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kelly said:
I currently working on a db for entering information based on a quote
system.
On the form I need to display some averages for user performance.

I need to display the usernames and the average 'hour" value for total
completed jobs. I have the correct time value being calculated by using
Brent's code and then seperatly calculating the hours and minutes.

I'm then calculating the average of the total for the users based on the
UserId.

The query I have and need to display for all the users is;

Username Average
Joe Smith 9.7
Jim Johns 7
Sue reynolds 8.2

I won't be displaying field descriptions, just the name & average. Your
help
made the first item display perfect. I would like to use the combo box to
display these records.

Here is the query data for one user;

SELECT t.UserID, t_User.UserName, Avg(t.Total_Hours) AS AvgOfTotal_Hours
FROM q_TotalWorkTime AS t INNER JOIN t_User ON t.UserID = t_User.UserID
GROUP BY t.UserID, t_User.UserName
HAVING (((t.UserID)=1));

Thanks so much!

Douglas J. Steele said:
Sorry, you'll have to give some more details. I don't understand what
you're
trying to do.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


How would I add multiple instances (different Id) to the form load
event?
I have a few users I'm calc. job time against. Can I place similair
lines
of
code in the vba?

Thank you so much! I've been struggling with this total time display
for a
bit. It takes quite, a bit at least fora beginner, to get the accurate
workdays, hrs, min, and all that good stuff.
Now I can move on to more good stuff...
Thank you,

:

You need to use VBA.

Set the property to [Event Procedure], then click on the ellipsis
(...)
to
the right of the property. That should take you into the VB Editor, in
the
middle of text like

Private Sub Form_Load

End Sub

Put that line of code in between those two lines.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I placed this in the forms event "on Load" Me.cboAvg1 =
Me.cboAvg1.ItemData(0)

When I reload the form, I get this message;

Microsoft cannot find the object Me

Do I need to add something to the Visual basic Library MQL?

Thanks,

:

Is the combo box bound to a field in the form's RecordSource? An
unbound
combo box, by default, doesn't show any data.

If it is unbound and you need to make it select the first value,
the
following code will do it:

Me.Combo0 = Me.Combo0.ItemData(0)

Replace "Combo0" with the actual name of your combo box.

This code can go in the form's Load event.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I have searched for this and could'nt find the answer I'm in need
of,
so
here
is my question.
I'm using Access 2007 and have a combo box referencing a query.
The
correct
result is showing up in the combo box, but the first "row" is
blank.
I
need
the combo box first row to show the results.

If I run the query that it's referencing, there is no blank first
row.

Example of row source;
SELECT [q_UserAvgId1].[UserID], [q_UserAvgId1].[UserName],
[q_UserAvgId1].[AvgOfTotal_Hours] FROM [q_UserAvgId1] ORDER BY
[UserName];

Thanks,
 
K

Kelly

The Combo boxes are then hidden and only the text boxes are being shown.

Kelly said:
Maybe a List box would be appropriate for this case? I'll give that a try and
see if I get the desired output.

Thanks again,

Douglas J. Steele said:
Sorry, you'll have to give some more details. I don't understand what you're
trying to do.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Kelly said:
How would I add multiple instances (different Id) to the form load event?
I have a few users I'm calc. job time against. Can I place similair lines
of
code in the vba?

Thank you so much! I've been struggling with this total time display for a
bit. It takes quite, a bit at least fora beginner, to get the accurate
workdays, hrs, min, and all that good stuff.
Now I can move on to more good stuff...
Thank you,

:

You need to use VBA.

Set the property to [Event Procedure], then click on the ellipsis (...)
to
the right of the property. That should take you into the VB Editor, in
the
middle of text like

Private Sub Form_Load

End Sub

Put that line of code in between those two lines.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I placed this in the forms event "on Load" Me.cboAvg1 =
Me.cboAvg1.ItemData(0)

When I reload the form, I get this message;

Microsoft cannot find the object Me

Do I need to add something to the Visual basic Library MQL?

Thanks,

:

Is the combo box bound to a field in the form's RecordSource? An
unbound
combo box, by default, doesn't show any data.

If it is unbound and you need to make it select the first value, the
following code will do it:

Me.Combo0 = Me.Combo0.ItemData(0)

Replace "Combo0" with the actual name of your combo box.

This code can go in the form's Load event.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I have searched for this and could'nt find the answer I'm in need of,
so
here
is my question.
I'm using Access 2007 and have a combo box referencing a query. The
correct
result is showing up in the combo box, but the first "row" is blank.
I
need
the combo box first row to show the results.

If I run the query that it's referencing, there is no blank first
row.

Example of row source;
SELECT [q_UserAvgId1].[UserID], [q_UserAvgId1].[UserName],
[q_UserAvgId1].[AvgOfTotal_Hours] FROM [q_UserAvgId1] ORDER BY
[UserName];

Thanks,
 
K

Kelly

Hi, forgot to metion the text box format is;

=Format([cboAvg1].[column](2),"0.##") & " hours"

This populates the text boxwith the correct information. I just need this to
point to the row with the information in it, row 2.
If there is no other way for a combo, I will take your advice with the
subform.

Thanks for all your help,

Douglas J. Steele said:
I don't understand the point of the combo box (nor why a list box would be
applicable either). The purpose of those controls is allow you to choose
from a list of possible values. Is that what you're going, or are you simply
trying to show a number of values on your form? If the latter, perhaps you
should use a subform, with that SQL being the RecordSource for the form
being used as a subform.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kelly said:
I currently working on a db for entering information based on a quote
system.
On the form I need to display some averages for user performance.

I need to display the usernames and the average 'hour" value for total
completed jobs. I have the correct time value being calculated by using
Brent's code and then seperatly calculating the hours and minutes.

I'm then calculating the average of the total for the users based on the
UserId.

The query I have and need to display for all the users is;

Username Average
Joe Smith 9.7
Jim Johns 7
Sue reynolds 8.2

I won't be displaying field descriptions, just the name & average. Your
help
made the first item display perfect. I would like to use the combo box to
display these records.

Here is the query data for one user;

SELECT t.UserID, t_User.UserName, Avg(t.Total_Hours) AS AvgOfTotal_Hours
FROM q_TotalWorkTime AS t INNER JOIN t_User ON t.UserID = t_User.UserID
GROUP BY t.UserID, t_User.UserName
HAVING (((t.UserID)=1));

Thanks so much!

Douglas J. Steele said:
Sorry, you'll have to give some more details. I don't understand what
you're
trying to do.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


How would I add multiple instances (different Id) to the form load
event?
I have a few users I'm calc. job time against. Can I place similair
lines
of
code in the vba?

Thank you so much! I've been struggling with this total time display
for a
bit. It takes quite, a bit at least fora beginner, to get the accurate
workdays, hrs, min, and all that good stuff.
Now I can move on to more good stuff...
Thank you,

:

You need to use VBA.

Set the property to [Event Procedure], then click on the ellipsis
(...)
to
the right of the property. That should take you into the VB Editor, in
the
middle of text like

Private Sub Form_Load

End Sub

Put that line of code in between those two lines.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I placed this in the forms event "on Load" Me.cboAvg1 =
Me.cboAvg1.ItemData(0)

When I reload the form, I get this message;

Microsoft cannot find the object Me

Do I need to add something to the Visual basic Library MQL?

Thanks,

:

Is the combo box bound to a field in the form's RecordSource? An
unbound
combo box, by default, doesn't show any data.

If it is unbound and you need to make it select the first value,
the
following code will do it:

Me.Combo0 = Me.Combo0.ItemData(0)

Replace "Combo0" with the actual name of your combo box.

This code can go in the form's Load event.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I have searched for this and could'nt find the answer I'm in need
of,
so
here
is my question.
I'm using Access 2007 and have a combo box referencing a query.
The
correct
result is showing up in the combo box, but the first "row" is
blank.
I
need
the combo box first row to show the results.

If I run the query that it's referencing, there is no blank first
row.

Example of row source;
SELECT [q_UserAvgId1].[UserID], [q_UserAvgId1].[UserName],
[q_UserAvgId1].[AvgOfTotal_Hours] FROM [q_UserAvgId1] ORDER BY
[UserName];

Thanks,
 

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