Combo Box and First Record

L

Lovespar

Hello, I based my combo box on a query that is sorted and my Table is
updating but when I open my form, there is information in all the fileds
except the field with my combo box. When I select an item from the combo box,
everything fills in correctly but I want the form to be completely blank when
it is open, open on a new record?
Thanks again
 
L

Lovespar

That cleared the form, but now the macro doesn't work
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Product_Unit_ID]= '" & Me![Combo198] & "'"

Me.Bookmark = rs.Bookmark THIS LINE IS HIGHLIGHTED IN YELLOW

Also what is the purpose or the record selection area on the bottom right
hand sidde of the form. Can it be hidden?
 
T

Tom Wickerath

That cleared the form, but now the macro doesn't work

Correct. You opened the form in AddNew mode, so there are zero records in
the recordset initially. The VBA code that you showed is typical for the
AfterUpdate event procedure, to assist the user in finding an *existing*
record in the form's recordset. But, if you intentionally open the form in
AddNew mode, guess what....your existing recordset has zero records
(initially--as you add new records, it will include these, but as soon as you
close and re-open the form, the recordset will be back to zero records
initially).

So, what do you want? To open a form to a blank new record, or to open a
form bound to a set of records via a query or table, with an unbound combo
box to assist you in finding a record? Although you can have both on the same
form, you would likely want some VBA code to hide the combo box if the form
was opened in AddNew mode. I think doing that is beyond the scope of this
question.

Also what is the purpose or the record selection area on the bottom right
hand side of the form. Can it be hidden?

Bottom right or bottom left? Yes, you can set the Visible property to No in
design view. As an alternative, you can set this property to No if the form
is opened in AddNew mode, but leave it visible if you are opening the form to
several records.


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________

Lovespar said:
That cleared the form, but now the macro doesn't work
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Product_Unit_ID]= '" & Me![Combo198] & "'"

Me.Bookmark = rs.Bookmark THIS LINE IS HIGHLIGHTED IN YELLOW

Also what is the purpose or the record selection area on the bottom right
hand side of the form. Can it be hidden?
__________________________________________

:

Set the Data Entry property of the form to Yes.

--
Lynn Trapp
MCP, MOS, MCAS

__________________________________________

:

Hello, I based my combo box on a query that is sorted and my Table is
updating but when I open my form, there is information in all the fileds
except the field with my combo box. When I select an item from the combo box,
everything fills in correctly but I want the form to be completely blank when
it is open, open on a new record?
Thanks again
 
L

Lovespar

Ok, New data is being uploaded via an excell spreadsheet so adding a new
record is not important. But modifying existing records is very important
and brings me back to my original question.
there is information showing in the form when it is opened, but my combo box
is blank. I would think that at least a record should show in the combo box
that matched the other data?


Tom Wickerath said:
That cleared the form, but now the macro doesn't work

Correct. You opened the form in AddNew mode, so there are zero records in
the recordset initially. The VBA code that you showed is typical for the
AfterUpdate event procedure, to assist the user in finding an *existing*
record in the form's recordset. But, if you intentionally open the form in
AddNew mode, guess what....your existing recordset has zero records
(initially--as you add new records, it will include these, but as soon as you
close and re-open the form, the recordset will be back to zero records
initially).

So, what do you want? To open a form to a blank new record, or to open a
form bound to a set of records via a query or table, with an unbound combo
box to assist you in finding a record? Although you can have both on the same
form, you would likely want some VBA code to hide the combo box if the form
was opened in AddNew mode. I think doing that is beyond the scope of this
question.

Also what is the purpose or the record selection area on the bottom right
hand side of the form. Can it be hidden?

Bottom right or bottom left? Yes, you can set the Visible property to No in
design view. As an alternative, you can set this property to No if the form
is opened in AddNew mode, but leave it visible if you are opening the form to
several records.


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________

Lovespar said:
That cleared the form, but now the macro doesn't work
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Product_Unit_ID]= '" & Me![Combo198] & "'"

Me.Bookmark = rs.Bookmark THIS LINE IS HIGHLIGHTED IN YELLOW

Also what is the purpose or the record selection area on the bottom right
hand side of the form. Can it be hidden?
__________________________________________

:

Set the Data Entry property of the form to Yes.

--
Lynn Trapp
MCP, MOS, MCAS

__________________________________________

:

Hello, I based my combo box on a query that is sorted and my Table is
updating but when I open my form, there is information in all the fileds
except the field with my combo box. When I select an item from the combo box,
everything fills in correctly but I want the form to be completely blank when
it is open, open on a new record?
Thanks again
 
T

Tom Wickerath

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

Combo Box 3
Combo Box Question 4
combo box filter 1
Combo Box Help 7
Sort with Combo box 2
Combo box question 7
Populate combo box from current record 3
Stop entry data to my combo box! 13

Top