LOCKING FIELD

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form where I want to be able to change pricing , but I do not want
to be able to change anything about the product number, name, or case count.
If I lock the item number field, you can not search that field to find the
record to update, but if I don't lock the field you can change the item
number.

Any suggestions on how to search a field, but not change it (changes will
affect the master prodcut list). Pricing needs to be seperated because there
are five levels of pricing.

Thanks
 
Lynette:

For navigation purposes you could add an unbound combo box to the form, e.g.
in its header, with a RowSource such as:

SELECT [ItemNuber]
FROM [YourTable]
ORDER BY [ItemNumber];

and in its AfterUpdate event procedure put the following code:

Dim rst As Object

Set rst = Me.Recordset.Clone

rst.FindFirst "[ItemNumber] = " & [cboItems]

If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
Else
MsgBox "Item not found.", vbInformation, "Warning"
End If

where cboItems is the name of the combo box. This assumes ItemNumber is a
number data type. If its text data type wrap the value in quotes:

rst.FindFirst "[ItemNumber] = """ & [cboItems] & """"

Its far better to use a separate unbound control like this for navigating
than to try and use a single control as both a bound control and a means of
navigating.

Ken Sheridan
Stafford, England
 
That makes sense - no double agent fields (lol).

I will try it.

Thank you
--
Lynette


Ken Sheridan said:
Lynette:

For navigation purposes you could add an unbound combo box to the form, e.g.
in its header, with a RowSource such as:

SELECT [ItemNuber]
FROM [YourTable]
ORDER BY [ItemNumber];

and in its AfterUpdate event procedure put the following code:

Dim rst As Object

Set rst = Me.Recordset.Clone

rst.FindFirst "[ItemNumber] = " & [cboItems]

If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
Else
MsgBox "Item not found.", vbInformation, "Warning"
End If

where cboItems is the name of the combo box. This assumes ItemNumber is a
number data type. If its text data type wrap the value in quotes:

rst.FindFirst "[ItemNumber] = """ & [cboItems] & """"

Its far better to use a separate unbound control like this for navigating
than to try and use a single control as both a bound control and a means of
navigating.

Ken Sheridan
Stafford, England

ksfireworksgal said:
I have a form where I want to be able to change pricing , but I do not want
to be able to change anything about the product number, name, or case count.
If I lock the item number field, you can not search that field to find the
record to update, but if I don't lock the field you can change the item
number.

Any suggestions on how to search a field, but not change it (changes will
affect the master prodcut list). Pricing needs to be seperated because there
are five levels of pricing.

Thanks
 
I have a form where I want to be able to change pricing , but I do not want
to be able to change anything about the product number, name, or case count.
If I lock the item number field, you can not search that field to find the
record to update, but if I don't lock the field you can change the item
number.

Any suggestions on how to search a field, but not change it (changes will
affect the master prodcut list). Pricing needs to be seperated because there
are five levels of pricing.

I'd suggest using TWO controls: one, locked and bound, to display; and
a second - probably a Combo Box - for searching. The Combo Wizard will
let you create an unbound combo box using the option "use this combo
to find a record".

John W. Vinson [MVP]
 
So when there is no row or control source, the data is not saved, just select
for the moment, correct?

It seems to work very well thank you.
 
So when there is no row or control source, the data is not saved, just select
for the moment, correct?

well... a combo with no Control Source lets you select but doesn't
save anything; it's therefore useful for searching (for the moment, as
you say).

But a combo with no Row Source is pretty much useless, not to say
impossible - the Row Source is the list of values that you can select,
so if there's no row source there's nothing THERE to be selected!

John W. Vinson [MVP]
 

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

Back
Top