Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tab Control 1

Status
Not open for further replies.

Gaylord

Technical User
Sep 26, 2002
49
DE
Hi,

I have a form, using the tab controller to split my information, into two sets, ie first page is client information, whilst the second page contains image controls.

I have a search window that allows some wildcard searching, which then returns, say three records. At this point I want to be able to move from record to record, which Access does automatically.... However, when I do this, the focus appears to stay on the currently viewed page, which more often than not is the image page.

I was thinking of just adding my own buttons to move from record to record, but was wondering if there was an event that I am missing somewhere????

If anyone could help that would be much appreciated

Regards

Jamie
 
Hi

I assume you know that to switch pages on the tab control, you set the .value property? eg

tabCtl.Value = 0

You do not say how you do the searching, but could you insert such a statement in the code which opens and closed the search form, for example?

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Ah, always to forget the helpful stuff, So here is my code for the query. As you can see I am basically opening the main_form with an OpenForm Command, using either surname or GUM_No depending on the types of characters being used.

This opens the form fine with all the correct data. But when using the record control at the bottom right of the screen I don't know where to set the focus event. It would be useful if they are searching for, say, all the ref numbers N123* (n1230 - n1239) and view them by the details..... Just a minor thing, but its bugging me and I'm pretty sure it is simple when you know how.

Thanks

Jamie

Dim QueryString As String
Dim ProcString As String
Dim OpenFormString As String

'retrieve the Search key from the form
If IsNull([Forms]![search_Form]![SearchString]) Then
MsgBox "Your must enter either part of the surname or GUM number", vbOKOnly, "Error"
Exit Sub
Else
QueryString = [Forms]![search_Form]![SearchString]
End If

'Remove first charcter
ProcString = Mid(QueryString, 2, 4)
'Check whether the string is numeric or not - if numeric - use GUM code, else use Surname
If IsNumeric(ProcString) Then
'Performs lookup based on part or complete string
OpenFormString = "GUM_No Like '*" & QueryString & "*'"
DoCmd.Close acForm, "search_Form"
DoCmd.OpenForm "Main_Form", , , OpenFormString
Else
'Performs lookup based on part or complete string
OpenFormString = "Surname Like '*" & QueryString & "*'"
DoCmd.OpenForm "Main_Form", , , OpenFormString
End If
 
I would do what KenReay suggested (tabCtl.Value = 0) and put this code in the OnCurrent event of the form.
 
Hi

I THINK, insetrting line of code marked **** will do it, if not setting the tabctl.value = 0 in the on open event of Main_Form should do it:

Dim QueryString As String
Dim ProcString As String
Dim OpenFormString As String

'retrieve the Search key from the form
If IsNull([Forms]![search_Form]![SearchString]) Then
MsgBox "Your must enter either part of the surname or GUM number", vbOKOnly, "Error"
Exit Sub
Else
QueryString = [Forms]![search_Form]![SearchString]
End If

'Remove first charcter
ProcString = Mid(QueryString, 2, 4)
'Check whether the string is numeric or not - if numeric - use GUM code, else use Surname
If IsNumeric(ProcString) Then
'Performs lookup based on part or complete string
OpenFormString = "GUM_No Like '*" & QueryString & "*'"
DoCmd.Close acForm, "search_Form"
DoCmd.OpenForm "Main_Form", , , OpenFormString
Forms![Main_Form]!TabCtl.Value = 0 ' ****
Else
'Performs lookup based on part or complete string
OpenFormString = "Surname Like '*" & QueryString & "*'"
DoCmd.OpenForm "Main_Form", , , OpenFormString
Forms![Main_Form]!TabCtl.Value = 0 ' ****
End If

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top