row source for Combo Box LIKE result form textbox

B

Billp

Hi,
Is it possible to make the row source for a combo box be driven from the
result of a text box where the result is a LIKE filter?

I have

Private Sub txtQuote_Number_AfterUpdate()

Dim strNewNumberPrefix As String
Dim s As String

strNewNumberPrefix = Left(Me![txtQuoteNumber], 1) 'remove the 0's to leave
the letter



If Not IsNull(Me![txtQuoteNumber]) Then
s = strNewNumberPrefix
End If

cboSER_Exists.RowSource = s
End Sub

The Row source filter will always be a letter.
Say the letter is "V" then I would wish to make the row source filter LIKE "V"

where s is the LIKE "V".

?????????????????
Than you in advance.
Best Regards
Bill
 
D

Dirk Goldgar

Billp said:
Hi,
Is it possible to make the row source for a combo box be driven from the
result of a text box where the result is a LIKE filter?

I have

Private Sub txtQuote_Number_AfterUpdate()

Dim strNewNumberPrefix As String
Dim s As String

strNewNumberPrefix = Left(Me![txtQuoteNumber], 1) 'remove the 0's to
leave
the letter



If Not IsNull(Me![txtQuoteNumber]) Then
s = strNewNumberPrefix
End If

cboSER_Exists.RowSource = s
End Sub

The Row source filter will always be a letter.
Say the letter is "V" then I would wish to make the row source filter LIKE
"V"

where s is the LIKE "V".

?????????????????
Than you in advance.
Best Regards
Bill


If I understand you correctly, I would set the combo box's RowSource
property at design time to a SQL statement along the lines of:

SELECT {some fields} FROM {some table}
WHERE {one of those fields} LIKE
Forms!{YourFormName}!txtQuoteNumber & "*";

Then in the AfterUpdate event of txtQuoteNumber, I would just requery the
combo box:

Private Sub txtQuote_Number_AfterUpdate()

Me.cboSER_Exists.Requery

End Sub
 
B

Billp

Yeah - wahoooooooooooooo
Thank You.

Very very appreciative.
Regards
Bill

Dirk Goldgar said:
Billp said:
Hi,
Is it possible to make the row source for a combo box be driven from the
result of a text box where the result is a LIKE filter?

I have

Private Sub txtQuote_Number_AfterUpdate()

Dim strNewNumberPrefix As String
Dim s As String

strNewNumberPrefix = Left(Me![txtQuoteNumber], 1) 'remove the 0's to
leave
the letter



If Not IsNull(Me![txtQuoteNumber]) Then
s = strNewNumberPrefix
End If

cboSER_Exists.RowSource = s
End Sub

The Row source filter will always be a letter.
Say the letter is "V" then I would wish to make the row source filter LIKE
"V"

where s is the LIKE "V".

?????????????????
Than you in advance.
Best Regards
Bill


If I understand you correctly, I would set the combo box's RowSource
property at design time to a SQL statement along the lines of:

SELECT {some fields} FROM {some table}
WHERE {one of those fields} LIKE
Forms!{YourFormName}!txtQuoteNumber & "*";

Then in the AfterUpdate event of txtQuoteNumber, I would just requery the
combo box:

Private Sub txtQuote_Number_AfterUpdate()

Me.cboSER_Exists.Requery

End Sub



--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
B

Billp

Hi,

For anyone interested the sql statement went like this.

SELECT tblSER.SER_Number, tblSER.SER_ID, tblSER.CustomerID,
tblSER.Company_Name
FROM tblSER
WHERE (((tblSER.SER_Number) Like
Left([Forms]![frmQuote_Number]![txtQuote_Number],1) & "*") AND
((tblSER.QuoteNumberRef)=False))
ORDER BY tblSER.SER_Number;


And it worked.

Ta
Bill

Billp said:
Yeah - wahoooooooooooooo
Thank You.

Very very appreciative.
Regards
Bill

Dirk Goldgar said:
Billp said:
Hi,
Is it possible to make the row source for a combo box be driven from the
result of a text box where the result is a LIKE filter?

I have

Private Sub txtQuote_Number_AfterUpdate()

Dim strNewNumberPrefix As String
Dim s As String

strNewNumberPrefix = Left(Me![txtQuoteNumber], 1) 'remove the 0's to
leave
the letter



If Not IsNull(Me![txtQuoteNumber]) Then
s = strNewNumberPrefix
End If

cboSER_Exists.RowSource = s
End Sub

The Row source filter will always be a letter.
Say the letter is "V" then I would wish to make the row source filter LIKE
"V"

where s is the LIKE "V".

?????????????????
Than you in advance.
Best Regards
Bill


If I understand you correctly, I would set the combo box's RowSource
property at design time to a SQL statement along the lines of:

SELECT {some fields} FROM {some table}
WHERE {one of those fields} LIKE
Forms!{YourFormName}!txtQuoteNumber & "*";

Then in the AfterUpdate event of txtQuoteNumber, I would just requery the
combo box:

Private Sub txtQuote_Number_AfterUpdate()

Me.cboSER_Exists.Requery

End Sub



--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

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