By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,462 Members | 2,360 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,462 IT Pros & Developers. It's quick & easy.

Problem with changing form's record source

P: 4
Hello everyone

I have a problem with this application in Access. Application itself is supposed to help users controling parts production.

The steps when using form:

Step 1. This specific form (Part_A_1) loads everything that has part_no like "Part_A" and data for the first point measurements. So it will be this row:
Expand|Select|Wrap|Line Numbers
  1. PART_A    1/10    1    3,5    0,1    -0,1    1    1    6
Step 2. The user sees the stantard size of this point and he measures it, after which he inputs what he measured into textboxes.
Step 3. After inputing user pushes "Pusz me" button, which runs querry like this:
Expand|Select|Wrap|Line Numbers
  1. SELECT *
  2. FROM tabela1
  3. WHERE tabela1.part_no Like Forms!Part_A_1!Tekst16 And tabela1.process Like Forms!Part_A_1!Tekst18 And tabela1.point_no=Forms!Part_A_1!Tekst20+1;
The point of this code is to load next point in table "Tabela1" and show the user it's measurement points allowing him to see the standards and allowed diffrences. So it should change the form recorsource to second point in table:
Expand|Select|Wrap|Line Numbers
  1. PART_A    1/10    2    4,2    0,2    -0,2    1    1    4
Step 4. After loading the second point program goes back to step 2.

The problem obviously is with step 3 - somehow I just can't make the form to change its recordsource. I would be very much obliged if you could help me out with this.

Tables that i use:
Table PARTS:
part_no (Text)
process (Text)
point_no (integer)
size (text)
upper_limit (integer)
lower_limit (integer)
measure_method_id (integer)
tool_id (integer)
measuring_points (integer)

the other tables goes here:
Table TOOLS
tool_id (integer)
tool_name (text)

table METHOD
measure_method_id (integer)
method_name (text)

Here's the database itself:
http://www.rapidspread.com/file.jsp?id=pgbynogmhj
Nov 20 '08 #1
Share this Question
Share on Google+
4 Replies


P: 3
Hello,

I don't know if it helps, but wouldn't be easier to do this:

Expand|Select|Wrap|Line Numbers
  1. DoCmd.GoToRecord acDataForm, Me.Name 
?
Nov 20 '08 #2

P: 4
God, I hate it when it turns out to be such obvious thing that makes me look like a fool ;p

Thanks moni85!

Anyway, here's another problem:

I put lest say... 4 txtBoxes on a picture. The plan is to show/hide them every time the button is pressed. I've put a .tag property on each of them, which will be deceisive to make it visible or not. To put it the short way:
Step 1:
- form loads with first record
- controls that have .tag property set to = "[point_no]" are .visible = true
Step 2:
- user pushes button
step 3:
- next record is being loaded to form,
- controls with tag = "[point_no]+1" becomes .visible = true
- all control that have .tag other "[point_no]+1" are made visible = false
3. go back to step 2

That's my current code for button_click :

Expand|Select|Wrap|Line Numbers
  1. Dim ctl As Control
  2. Dim punkt As Integer
  3.  
  4. If Me.Recordset.AbsolutePosition + 1 < Me.Recordset.RecordCount Then 'checking if it's the last in recordset
  5.  
  6.     punkt = Me.Tekst20  'that's where the [point_no] from table is at
  7.  
  8.     For Each ctl In Me.Controls 'checking tags
  9.         If ctl.Tag = punkt Then ctl.Visible = True
  10.     Next ctl
  11.  
  12.     DoCmd.GoToRecord acDataForm, Me.Name, acNext 'go to next record
  13.     Me.Tekst16.SetFocus 'changing focus to other control
  14.     For Each ctl In Me.Controls 'start looping controls:
  15.      Select Case ctl.Tag 'checking control tag for specific value
  16.         Case punkt 'in case ctl.tag = punkt
  17.             Tekst20.SetFocus 'change focus to point_no
  18.             If ctl.Tag <> punkt Then ctl.Visible = False 'if ctl.tag != punkt then hide it
  19.         Case Else 'case ctl.tag != punkt, do nothing
  20.      End Select
  21.     Next ctl 'loop next control
  22.  
  23.  
  24. End If       
  25.  
Nov 24 '08 #3

P: 4
God, I hate it when it turns out to be such obvious thing that makes me look like a fool ;p

Thanks moni85!

Anyway, here's another problem:

I put lest say... 4 txtBoxes on a picture. The plan is to show/hide them every time the button is pressed. I've put a .tag property on each of them, which will be deceisive to make it visible or not. To put it the short way:
Step 1:
- form loads with first record
- controls that have .tag property set to = "[point_no]" are .visible = true
Step 2:
- user pushes button
step 3:
- next record is being loaded to form,
- controls with tag = "[point_no]+1" becomes .visible = true
- all control that have .tag other "[point_no]+1" are made visible = false
3. go back to step 2

That's my current code for button_click :

Expand|Select|Wrap|Line Numbers
  1. Dim ctl As Control
  2. Dim punkt As Integer
  3.  
  4. If Me.Recordset.AbsolutePosition + 1 < Me.Recordset.RecordCount Then 'checking if it's the last in recordset
  5.  
  6.     punkt = Me.Tekst20  'that's where the [point_no] from table is at
  7.  
  8.     For Each ctl In Me.Controls 'checking tags
  9.         If ctl.Tag = punkt Then ctl.Visible = True
  10.     Next ctl
  11.  
  12.     DoCmd.GoToRecord acDataForm, Me.Name, acNext 'go to next record
  13.     Me.Tekst16.SetFocus 'changing focus to other control
  14.     For Each ctl In Me.Controls 'start looping controls:
  15.      Select Case ctl.Tag 'checking control tag for specific value
  16.         Case punkt 'in case ctl.tag = punkt
  17.             Tekst20.SetFocus 'change focus to point_no
  18.             If ctl.Tag <> punkt Then ctl.Visible = False 'if ctl.tag != punkt then hide it
  19.         Case Else 'case ctl.tag != punkt, do nothing
  20.      End Select
  21.     Next ctl 'loop next control
  22.  
  23.  
  24. End If       
  25.  
Nov 24 '08 #4

P: 4
Solved it, topic to be deleted
Nov 25 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.