Help with some code

robcrussiii

Registered User.
Local time
Yesterday, 16:30
Joined
Mar 1, 2005
Messages
12
Im am having some difficulties with the correct record being called into my form. Attached is a .gif file of my set up. Basically when someone signs out they are listed in the currently out box (using various < > Null statements in a query), and when you click thier name in that box it should populate the right hand side with the information causing them to be in the currently out list. Problem is my code is not bringing in the correct record that caused them to be listed in the box to begin with. If you notice 'Robert' is listed in the currently out, and clicking on his name populated a past item and not the record that caused him to be out. The item causing him to be out is the 2nd table entry on tblsignout because there is no timein (its null) so it shows him in the currently out. Where am I going wrong in my code? This is what I have currently in the afterupdate for the lstOut:

Dim strSearch As String

strSearch = "[EmpID] = " & Me![lstOut]

Me.RecordsetClone.FindFirst strSearch
Me.Bookmark = Me.RecordsetClone.Bookmark
Me.cboEmpName.Locked = True

- Doh, had put the wrong code up... that is the right one
 

Attachments

  • signin.gif
    signin.gif
    20.4 KB · Views: 148
Last edited:
I haven't read your post yet, just looked at the picture and you can combine the first 2 criterias by setting >0 | <=0 or Is Null

also

strSearch = "[EmpID] = '" & Me![lstOut].Value & "'"
or
strSearch = "[EmpID] = """ & Me![lstOut].Value & """
 
Last edited:
I am defiantly new at all this. Any input on better ways etc to do this I am more than open to. This is about a learning project for me. Thanks for taking a look.
 
I'll help more when I get home, this seems simple.. I just gotta start closing up my workstation - that is to say if no one else gets to you first.

-modest
 
Thanks modest, I tried both those statements and Im getting a error on this line now

Me.RecordsetClone.FindFirst strSearch

Its just highlighted in yellow, doesnt tell me much heheSignin

-If you want to take a closer look :)
 
Last edited:
attachment doesn't work.


first make sure that there is something in the value:
strSearch = "[EmpID] = '" & Me.[lstOut].Value & "'" should work so put
msgbox "Value in listbox: " & Me.[lstOut].Value after you set your string

if you're sure the field is populated,try:

Me.RecordsetClone.FindFirst "[EmpID] = FORMS![Form Name]![lstOut].Value"
 
you lost me here...

so put
msgbox "Value in listbox: " & Me.[lstOut].Value after you set your string

The link should work now, btw haha
 
Last edited:
just put "msgbox "Value in listbox: " & Me.[lstOut].Value" on the line following "strSearch = ..." so you can see what lstOut.Value is

just doing some simple debugging.
 
No luck with that, sorry I just get compile errors etc. I dont think I am understanding what you mean by "Value in list box:", you refering to the row source information for the lstOut box?

It seems to be pulling in the information from the qrySignOut but just pulling the wrong record. I have a sql statement in the row source of lstOut

SELECT DISTINCT [qrySignOut].[EmpID], [qrySignOut].[EmpName], [qrySignOut].[Out] FROM qrySignOut WHERE [qrySignout].[Out]=0 ORDER BY [qrySignOut].[EmpName];

In the pic in the qrySignout the record it should be showing for Ben is the one that has a 0 value for the 'Out' field(this is what puts him in the lstOut box, but its pulling in the 1st one with a -1, or the first record (maybe my findfirst call?). I am stumped I think I need to use some other type of command? SOmething I can qualify to pull the record that 'Out' has a value of 0?

- Value in listbox: 30???
 

Attachments

  • sign2.GIF
    sign2.GIF
    52.6 KB · Views: 145
Last edited:
I think I mislead myself assuming you were doing something that you weren't. I have to get up early for work tomorrow, so if I have time during lunch, I'll actually read what you want carefully.

(as I said before I've only had time to skim what you wrote, my answers thus far have been based only on possible syntax issues.. so I assume this is a simple matter. I'll look into the logic tomorrow)
 

Users who are viewing this thread

Back
Top Bottom