To serve man ...

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

Guest

.... a new record. (Sorry for the lame joke).

What I want to do is have one form with a command button that when pushed
will pop up a record from a table for that person to work on. I need it to
know what records are currently being worked on so that it does no give the
same record to multiple users. How can this be done?
 
... a new record. (Sorry for the lame joke).

What I want to do is have one form with a command button that when pushed
will pop up a record from a table for that person to work on. I need it to
know what records are currently being worked on so that it does no give the
same record to multiple users. How can this be done?

Either set the form's Data Entry property to True, so that it will display
ONLY the blank "new record" when the form is opened; or put code in the click
event of your command button, using the command button wizard and choosing the
"go to new record" option.

John W. Vinson [MVP]
 
Sorry, forgot one peice of information ... the table already has data in it.
Users will take that information and input it into another program. I need
the button to give the user a record to work on.
 
Sorry, forgot one peice of information ... the table already has data in it.
Users will take that information and input it into another program. I need
the button to give the user a record to work on.

Any old record, just so nobody else is currently working on it?? Is there any
way to identify "worked on" records? Are records worked on, then input to the
other program, and then no longer needed - or can they be reused by anotehr
user? This is VERY peculiar, and I'm not at all sure how to accomplish it!

John W. Vinson [MVP]
 
What i have so far is a Yes/No field that they would check once completed.
There will be no need to go back to a completed record. What i need is a way
to save the record once displayed on the screen but before marked completed.
That way i could have the form built off a query that filters out completed
and "being worked". I just dont know how to mark it "being worked" with out
the user saving the record manually. Is there a way when the record is
loaded that it can save it with some indicator when delivered to the user?
 
me.dirty = false
will do it

Pieter

Greg H. said:
What i have so far is a Yes/No field that they would check once completed.
There will be no need to go back to a completed record. What i need is a
way
to save the record once displayed on the screen but before marked
completed.
That way i could have the form built off a query that filters out
completed
and "being worked". I just dont know how to mark it "being worked" with
out
the user saving the record manually. Is there a way when the record is
loaded that it can save it with some indicator when delivered to the user?
 
What i have so far is a Yes/No field that they would check once completed.
There will be no need to go back to a completed record. What i need is a way
to save the record once displayed on the screen but before marked completed.
That way i could have the form built off a query that filters out completed
and "being worked". I just dont know how to mark it "being worked" with out
the user saving the record manually. Is there a way when the record is
loaded that it can save it with some indicator when delivered to the user?

In the Form Current event you could put

Me.workedon = True
Me.Dirty = False

to mark the record as being (having been) worked on, and immediately save it
to disk. That may be too hairtrigger as it will mark the record the instant
it's opened, even if only for viewing.

John W. Vinson [MVP]
 
When i use both lines of code i get the error

Compile Error:

Method or data membor not found

And it highlights .workedon =

Any ideas? I tried to just use Me.Dirty = False but when i accessed the
form from my computer and from another computer and user id, i get the same
record.

Sorry if im being dense here, im just new to these advanced features in
Access.
 
When i use both lines of code i get the error

Compile Error:

Method or data membor not found

And it highlights .workedon =

I don't know the name of the control or field in your table which indicates
that a record has been worked on. I guessed it was named "workedon". Since
it's not, replace m guess with the actual name of the field.
Any ideas? I tried to just use Me.Dirty = False but when i accessed the
form from my computer and from another computer and user id, i get the same
record.

You'll need to base the form, not on the Table, but on a query selecting only
records which have False in this "workedon" field (whatever it's called).

John W. Vinson [MVP]
 
Would it be possible for me to send to you what im working on so you can look
at it. Im sorry if im dense, im just new to coding in ACCESS. Thanks again
for all your help.
 
Would it be possible for me to send to you what im working on so you can look
at it. Im sorry if im dense, im just new to coding in ACCESS. Thanks again
for all your help.

Sorry... but as a selfemployed consultant, making my living selling such
services, that is more than I'm willing to do on the newsgroups.

Instead, please post your VBA code (copy and paste the whole thing); the names
of the relevant controls on the form; their Control Source properties; and
open the form's Recordsource property in SQL view and post the SQL text here.
We should be able to get this working.

John W. Vinson [MVP]
 
This is all i have ...
tbl_data
Respid Text
ContactDate Date/Time
Mtn Text
Rename Text
InterviewDate Date/Time
Completed Yes/No
Notes Memo
User ID Text

qry_Unrecorded_Records
Field Criteria
Respid
ContactDate
Mtn
Rename
InterviewDate
Completed “Noâ€
Notes
User ID

frm_unrecorded_Records
‘built off of qry_Unrecorded_Records.
‘I would like to use =Username() as the default value for User ID. This
could be used as the record that gets saved to record it as being worked on.

----------------
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Function UserName() As String
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If (lngX > 0) Then
UserName = Left$(strUserName, lngLen - 1)
Else
UserName = vbNullString
End If
End Function
 
This is all i have ...
tbl_data
Respid Text
ContactDate Date/Time
Mtn Text
Rename Text
InterviewDate Date/Time
Completed Yes/No
Notes Memo
User ID Text

Does the Completed field indicate that the record has (or is being) "worked
on"? If not, you need to add a new field in the table. Access cannot determine
that a record has been worked on unless you record that fact somewhere in a
table!
qry_Unrecorded_Records
Field Criteria
Respid
ContactDate
Mtn
Rename
InterviewDate
Completed “No”
Notes
User ID

It is helpful for those of us who answer questions here if you open the Query
in SQL view and post the SQL text here. It may look like Old Akkadian
cuneiform tablet writing to you at this point, but it's the *real* query and
it's the best way to communicate queries.
frm_unrecorded_Records
‘built off of qry_Unrecorded_Records.
‘I would like to use =Username() as the default value for User ID. This
could be used as the record that gets saved to record it as being worked on.

So? Use it; set the DefaultValue property of the form textbox bound to User ID
(which I'd rename UserID, blanks in fieldnames are legal but can cause
problems later) to that expression.

Nowhere in your code do you indicate where you're setting the value of the
Completed field.

John W. Vinson [MVP]
 
Back
Top