basic question! or ?

nebon

Registered User.
Local time
Today, 09:08
Joined
May 14, 2003
Messages
51
hallo there guys, first got to thanks everyone on this forum, I have registered yesterday, since then been always in here .. :o)
I have a smal problem in vb , the thing is , I am trying to store a value from a query(which has a reference to a combobox from the form). This value should be stored on a textbox.
sounds confusing , but I hope you understand what I am trying to do . the question is :
is this wrong ?
Me.idbox = DLookup("Show_id", "testLocateshow", Null)

it is saying: " first save record then you can edit this field "
when it comes to this peace of code , why is that , and is there another way of doing it ? that is, storing the bound column in a textbox in the same form . thanks again guys !
 
Change your line to this and post back with the results.

Me.idbox = DLookup("[Show_id]", "testLocateshow")
 
same thing .. hmmm is it complaining because I am making a refernece to a query which uses the same form it self ?
 
Can you make an example and post it?
 
okai basicaly I am running the form "z" and z is using this query:

SELECT TblShow.SHOW_ID, TblShow.FILM_REF, TblShow.SHOW_DATE
FROM TblShow
WHERE (((TblShow.FILM_REF)=[forms]![z]![combo0]) AND ((TblShow.SHOW_DATE)=[forms]![z]![combo3]));


and after evaluating the appropriate record , the show_id is stored in a textbox , but as soon as I try to do :
Me.idbox = DLookup("[Show_id]", "testLocateshow")
it gives the following error : "first save the record, then you can edit it" this is done of the after update event on combo3
 
If form "z" is bound to the query you've stated then why not just bind the textbox Idbox to ShowID?

That would make more sense to me...


With an example I could visually see what you are trying to do...
 
that is exactly what I want to do , I know how to bind it to a combobox through the rowsource , but how do you do it with a textbox ?
 
One of us is getting lost here...

If the form has the query set as its RecordSource property then you can set IDbox's ControlSource property to the field you want.

Listboxes and comboboxes can present numerous columns from a query but only one can ever be bound to a table.
 
no the query is not the forms rowsource !

I just want to grap the show_id value (from thiis query) in accordance of the selection he/she makes in the form and place it in a textbox!
hmm !?
 
Code:
Private Sub cboYourCombo_BeforeUpdate(Cancel As Integer)

    If IsNull(DLookup("[Show_ID]", "testLocateShow")) Then
        Cancel = True    
    End If

End Sub

Private Sub cboYourCombo_AfterUpdate()

    Me.IDbox = DLookup("[Show_ID]", "testLocateShow")

End Sub

Provided that testLocateShow is the name of the query and Show_ID is a field within that query.
 
Its working now , thanks man ! thanks alot ! and thanks again !




















..
and again !
 

Users who are viewing this thread

Back
Top Bottom