Data Entry after Select Query

G

Guest

Is there a way to tell a Form to go to Data Entry = Yes, after you have
populated two fields on a form?

I am running..

Private Sub Form_Open(Cancel As Integer)
Dim varUnique As Variant

varUnique = DMax("Key", "qryB_Update")

End Sub

But, after it populates the form with the data from the query, I would like
to lock the form down to a Data Entry form. Keeping the data the I filled
with the above code.

Thanks.
 
G

Guest

I'm assuming you are assigning the varUnique value to a certain field.

If that's the case then add the following to your code

Private Sub Form_Open(Cancel As Integer)
Dim varUnique As Variant

me.DataEntry=true '-> add this line
varUnique = DMax("Key", "qryB_Update")
me.textbox=varunique '-> if you want to assign it to a field...

End Sub

Remember this only works once because you've placed the code in the on open
of the form..

hth
 
G

Guest

Maurice,
Thanks for the response, but, I can't seems to get the code to work. Adding
the me.DataEntry = True still locks the form down to a data entry only and
doesn't show the fields populated by the query. There for it adds a new
record in the table under the record with the record the data populated by
the query.
 
G

Guest

Yes, the dataentry options sets a new record. So best option is to lock the
controls individually when you have opened the form. Remains the question why
you want to set the form to data entry. Why not set the controls to locked
once they are populated with the values. You could set them to
me.textbox.locked=true.

If you want to use some kind of loop for this you could use something like

Private Sub Form_Open(Cancel As Integer)
Dim varUnique As Variant
Dim ctl As control

varUnique = DMax("Key", "qryB_Update")

for each ctl in me
if ctl.tag = "some text" then
ctl.locked=true
end if
next

End Sub

In this case you could place a text in the tag of the control. for instance
"lock".
replace the "some text" for the text you place in the tag of the control.

hth
 
G

Guest

Maurice, Thanks again for the quick response.

I am going after the Data Entry Form because of the users entering the data!
I need to make the DB as bullet proof, easy and simple as possible. The
less screens they can jump around too, the less they will be confused and
call me.

I think one of the best fixes is the DLL that lets you kill the mouse wheel,
but I am having a hard time getting my IT people to let me install it for
some reason.

Thanks for the code on the field locks. I may be able to work with that.

Thanks again.
 

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